oracle数据库的运行状态,Oracle数据库在线运行情况检查

实例信息:

select instance_name,host_name,version,to_char(startup_time,'yyyy-mm-dd hh24:mi') startuptime,status,archiver from v$instance;

会话限制信息:

SELECT resource_name, current_utilization,

max_utilization,

LIMIT,

ROUND (max_utilization / LIMIT * 100) || '%' rate

FROM (SELECT resource_name,

current_utilization,

max_utilization,

TO_NUMBER (initial_allocation) LIMIT

FROM v$resource_limit

WHERE resource_name IN ('processes', 'sessions')

AND max_utilization > 0);

profile:

select profile,resource_name,resource_type,limit from dba_profiles order by profile,resource_type,resource_name;

parameter:

select name,value from v$parameter where name in('background_dump_dest','control_files','cluster_database','db_block_size','open_cursors','spfile','undo_management','undo_retention','undo_tablespace')order by name;

内存配置(Oracle9i):

select component,current_size/1024/1024 cur_size_M from v$sga_dynamic_components

union all

select name,round(value/1024/1024) from v$parameter where name in ('sga_max_size','sga_target','pga_aggregate_target');

内存配置(Oracle10g) :

select component,current_size/1024/1024 cur_size_M ,max_size/1024/1024

max_size_M from v$sga_dynamic_components;

内存配置(Oracle11g):

select component,current_size/1024/1024 cur_size_M from v$memory_dynamic_components

union all

select name,round(value/1024/1024) from

v$parameter where name in ('memory_target','memory_max_target','sga_max_size','sga_target','pga_aggregate_target');

Redo log information:

select b.thread#,b.group#,a.member,b.bytes/1024/1024,b.status,b.archived from v$logfile a ,v$log b where a.GROUP#=b.GROUP# order by  b.thread#,b.group#,a.member;

日志切换频率:

select * from (

select to_char(trunc(first_time, 'HH'),'yyyy-mm-dd hh24') time, count(*)

from v$loghist

group by to_char(trunc(first_time, 'HH'),'yyyy-mm-dd hh24') order by time desc) where to_date(time,'yyyy-mm-dd hh24')>sysdate-7;

表空间使用率:

select b.tablespace_name,

b.total_size_m as "total(mb)",

nvl(a.free_size_m, 0) as "free(mb)",

b.total_size_m-nvl(a.free_size_m, 0) as "used(mb)",

decode(a.free_size_m,

'',

100,

round((b.total_size_m-a.free_size_m) / b.total_size_m * 100, 2)) as "used_rate",

c.status,c.contents,c.extent_management as "extent_mgr" ,c.segment_space_management AS "segment_mgr",

c.bigfile

from (select tablespace_name, sum(bytes) / 1024 / 1024 as free_size_m

from dba_free_space

group by tablespace_name) a,

(select tablespace_name, sum(bytes) / 1024 / 1024 as total_size_m

from dba_data_files

group by tablespace_name) b,

(select tablespace_name,status,contents, extent_management,

segment_space_management,bigfile from dba_tablespaces) c

where b.tablespace_name = a.tablespace_name(+)

and b.tablespace_name =c.tablespace_name(+)

union all

select b.TABLESPACE_NAME,

b.bytes / 1024 / 1024 as "total(mb)",

(b.bytes- nvl(a.used_bytes, 0))/1024/1024 as "free(mb)",

nvl(a.used_bytes, 0) / 1024 / 1024 as "used(mb)",

decode(a.used_bytes, null, 0, round(a.used_bytes / b.bytes * 100, 2)) as "used_rate",

c.status,c.contents,c.extent_management as "extent_mgr" ,c.segment_space_management AS "segment_mgr",

c.bigfile

from (select s.TABLESPACE_NAME,

s.total_blocks * p.value as total_bytes,

s.free_blocks * p.value as free_bytes,

s.used_blocks * p.value as used_bytes

from v$sort_segment s, v$parameter p

where p.NAME = 'db_block_size') a,

(select tablespace_name, sum(user_bytes) as bytes

from dba_temp_files

group by tablespace_name) b,

(select tablespace_name,status,contents, extent_management,

segment_space_management,bigfile from dba_tablespaces) c

where b.tablespace_name = a.TABLESPACE_NAME(+)

and b.tablespace_name = c.TABLESPACE_NAME(+)

order by 5 desc;

数据文件部署状况:

select * from (

select file_name,tablespace_name,bytes/1024/1024 mb,status,autoextensible from dba_data_files

union all

select file_name,tablespace_name,bytes/1024/1024 mb,status,autoextensible from dba_temp_files)

order by tablespace_name,file_name;

Segment information:

select a.*,b.num_rows,b.partitioned,b.last_analyzed_time from (select owner,segment_name,segment_type,Size_MB

from (select owner,

segment_name,

sum(bytes) / 1024 / 1024 as Size_MB ,

segment_type

from dba_segments

group by owner, segment_name, segment_type

having sum(bytes)/1024/1024 >100

order by 3 desc)

where rownum < 50 )a left join

(select owner,table_name,num_rows,partitioned,to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') as last_analyzed_time from dba_tables ) b

on a.owner=b.owner

and a.segment_name=b.table_name;

unusable index :

select owner,index_name,table_name,status from  dba_indexes where status ='UNUSABLE'    order by owner,table_name,index_name;

recyclebin information(oracle10g/11g):

select owner,count(*) from dba_recyclebin group by owner;

asm_diskgroup information:

select  group_number,name,state,type,total_mb ,free_mb from v$asm_diskgroup;

asm_disk information:

select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk order by group#,disk#;

响应最慢的前50个sql:

select * from (select to_char(l.start_time,'yyyy-mm-dd hh24:mi:ss') as start_time, l.ELAPSED_SECONDS,s.SQL_ID,s. SQL_TEXT from v$sqlarea s,v$session_longops l where s.sql_id=l.sql_id and l.ELAPSED_SECONDS>5 order by l.ELAPSED_SECONDS desc) where rownum<51;

alert文件里的错误信息:

查找alert文件:

select value||'\alert_'||(select instance_name from v$instance)||'.log' from v$parameter where name='background_dump_dest';

文件系统利用率:

windows:查看数据文件所在磁盘的空间,已用空间

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
检查数据库基本状况........................................................................................................ 4 1.1. 检查 ORACLE 实例状态.............................................................................................. 4 1.2. 检查 ORACLE 服务进程.............................................................................................. 4 1.3. 检查 ORACLE 监听状态.............................................................................................. 5 2. 检查系统和 ORACLE 日志文件..................................................................................... 6 2.1. 检查操作系统日志文件............................................................................................. 6 2.2. 检查 ORACLE 日志文件.............................................................................................. 6 2.3. 检查 ORACLE 核心转储目录...................................................................................... 7 2.4. 检查 ROOT 用户和 ORACLE 用户的 EMAIL............................................................... 7 3. 检查 ORACLE 对象状态................................................................................................. 7 3.1. 检查 ORACLE 控制文件状态...................................................................................... 7 3.2. 检查 ORACLE 在线日志状态...................................................................................... 8 3.3. 检查 ORACLE 表空间的状态...................................................................................... 8 3.4. 检查 ORACLE 所有数据文件状态.............................................................................. 8 3.5. 检查无效对象............................................................................................................. 9 3.6. 检查所有回滚段状态............................................................................................... 10 4. 检查 ORACLE 相关资源的使用情况........................................................................... 10 4.1. 检查 ORACLE 初始化文件中相关参数值................................................................ 10 4.2. 检查数据库连接情况............................................................................................... 11 4.3. 检查系统磁盘空间................................................................................................... 12 4.4. 检查表空间使用情况............................................................................................... 12 4.5. 检查一些扩展异常的对象....................................................................................... 13 4.6. 检查 SYSTEM 表空间内的内容................................................................................. 14 4.7. 检查对象的下一扩展与表空间的最大扩展值....................................................... 14 5. 检查 ORACLE 数据库备份结果................................................................................... 14 5.1. 检查数据库备份日志信息....................................................................................... 15 5.2. 检查 BACKUP 卷中文件产生的时间........................................................................ 15 5.3. 检查 ORACLE 用户的 EMAIL..................................................................................... 15 6. 检查 ORACLE 数据库性能........................................................................................... 15 6.1. 检查数据库的等待事件........................................................................................... 15 6.2. DISK READ 最高的 SQL 语句的获取...................................................................... 15 6.3. 查找前十条性能差的 SQL........................................................................................ 16 6.4. 等待时间最多的 5 个系统等待事件的获取........................................................... 16 6.5. 检查运行很久的 SQL.............................................................................................. 16 6.6. 检查消耗 CPU 最高的进程..................................................................................... 16 6.7. 检查碎片程度高的表............................................................................................... 17 6.8. 检查表空间的 I/O 比例......................................................................................... 17 6.9. 检查文件系统的 I/O 比例..................................................................................... 176.10. 检查死锁及处理................................................................................................... 17 6.11. 检查数据库 CPU、 I/O、内存性能...................................................................... 18 6.12. 查看是否有僵死进程........................................................................................... 19 6.13. 检查行链接/迁移.................................................................................................. 19 6.14. 定期做统计分析................................................................................................... 19 6.15. 检查缓冲区命中率............................................................................................... 20 6.16. 检查共享池命中率............................................................................................... 20 6.17. 检查排序区........................................................................................................... 20 6.18. 检查日志缓冲区................................................................................................... 21 7. 检查数据库安全性.......................................................................................................... 21 7.1. 检查系统安全日志信息........................................................................................... 21 7.2. 检查用户修改密码................................................................................................... 21 8. 其他检查.......................................................................................................................... 22 8.1. 检查当前 CRONTAB 任务是否正常.......................................................................... 22 8.2. ORACLE JOB 是否有失败.......................................................................................... 22 8.3. 监控数据量的增长情况........................................................................................... 22 8.4. 检查失效的索引....................................................................................................... 23 8.5. 检查不起作用的约束............................................................................................... 23 8.6. 检查无效的 TRIGGER............................

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值