巡检步骤
主机OS版本(AIX) oslevel -r
查SID ps -ef | grep oracle
数据库版本 select * from v$version;
查警告日志alter log
show parameter dump 看bdump找到alterlog位置
VI查找ORA-关键字
查看数据库状态
select open_mode from v$database;
select status from v$instance;
查看控制文件状态
select * from v$controlfile;
查看redo状态
select status,group#,archived,bytes/1024/1024 SIZE_M,sequence#,first_change#,MEMBERS from v$log;
select group#,member from v$logfile;
系统资源使用情况
listener状态
lsnrctl status
归档模式
archive log list;
1.数据库空间:
数据库表空间使用情况 表空间自动扩展
select tablespace_name,file_name,bytes/1024/1024,autoextensible,maxbytes/1024/1024 from dba_data_files;
select tablespace_name,status,extent_management,allocation_type,contents from dba_tablespaces;
select tablespace_name,sum(bytes)/1024/1024 total_size from dba_data_files group by tablespace_name;
查看剩余表空间有多少MB
select tablespace_name,sum(bytes)/1024/1024 free_size from dba_free_space group by tablespace_name;
查看表空间碎片度
select tablespace_name,sqrt(max(blocks) / sum(blocks)) * (100 / sqrt(sqrt(count(blocks)))) FSFI from dba_free_space group by tablespace_name;
查找大于2G的表
select segment_name,segment_type,owner from dba_segments where segment_type in ('INDEX','TABLE') AND bytes/1024/1024>2000;
查找大于一亿行的表
select table_name,owner,num_rows from dba_tables where NUM_ROWS>100000000;
查看system表空间内都有哪些用户的对象
select distinct owner from dba_segments where tablespace_name='SYSTEM';
查看USER表空间内都有哪些用户的对象
select distinct owner from dba_segments where tablespace_name='USERS';
查看用户角色(注意具有DBA角色的用户)
select * from dba_role_privs;
数据库是否有失效对象:
select owner,object_name,status from dba_objects where status='INVALID';
数据库是否有失效索引
select index_name,owner,table_name from dba_indexes where status !='VALID';
看"状态列"有几种
SQL> select distinct status from dba_objects;
SQL> select status from dba_objects group by status;
遇到INVALID的对象
alter view $OWNER.$OBJECT compile
如果太多则不适合使用
执行脚本(sysdba用户)
SQL >@?/rdbms/admin/utlrp.sql
查看密码复杂度函数是否启用
select * from dba_profiles where resource_type='PASSWORD';
数据卷使用情况
先看数据文件存放位置
select file_name from dba_data_files;
df -g 单位GB (AIX上)
ORACLE后台进程有无异常:
select * from v$bgprocess where paddr<>'00';
col error format 9999999
select name,error from v$bgprocess;
SQL > l 查看上一个命令
SQL > / 执行上一条命令
获取awr报告
SQL >@?/rdbms/admin/awrrpt.sql
查询keep pool 在dba_segments这个表里面
select buffer_pool,sum(bytes)/1024/1024 from dba_segments group by buffer_pool;
查出 buffer_pool里面的有哪些池 它们的大小
select sum(bytes)/1024/1024 from dba_segments where buffer_pool='DEFAULT' and segment_type='TABLE';
查出segment_type为TABLE,default pool的大小
阅读(2234) | 评论(0) | 转发(0) |