在oracle10g中增加了dba_his_*类统计信息表,在瓶颈时间过时了的时候,可以参考这些表来诊断瓶颈来源。 1、确定时间段: select * from dba_hist_sna
在oracle10g中增加了dba_his_*类统计信息表,在瓶颈时间过时了的时候,可以参考这些表来诊断瓶颈来源。
1、确定时间段:
select * from dba_hist_snapshot
where snap_id between &snapid1 and &snapid2
order by end_interval_time;
例如以上&snapid1 and &snapid2的值分别为10910 and 10913
2、对瓶颈时间段的等待时间进行汇总排序:
select event,count(*) from dba_hist_active_sess_history
where snap_id between 10910 and 10913
group by event
order by 2;
[@more@]3、根据排序情况,确定等待时间并根据确定等待时间,进一步观察相关字段内容:
select * from dba_hist_active_sess_history
where snap_id between 10910 and 10913
and event='enq: TX - row lock contention'
order by sample_time;
4、明确该等待时间相关的sql_ID:
select sql_id,count(*) from dba_hist_active_sess_history
where snap_id between 10910 and 10913
and event='enq: TX - row lock contention'
group by sql_id;
5、根据SQL_ID找出SQL语句:
select * from dba_hist_active_sess_history
where snap_id between 10910 and 10913
and event='enq: TX - row lock contention'
and sql_id='fhdxrqd4stwqk';
6、查看SQL当时对应的执行计划:
select id,operation, options,object_owner,object_name,object_type,cost,cardinality,bytes,cpu_cost,io_cost
from DBA_HIST_SQL_PLAN where sql_id='djpvmvjddy8av'
order by id;
也可以调用dbms_xplan.display_awr包来查看执行计划:
SQL> select * from table(dbms_xplan.display_awr('djpvmvjddy8av'));
7、也可查看类此对象的更多SQL:
select * from dba_hist_active_sess_history
where snap_id between 10910 and 10913
and sql_text like '%QRTZ_SCHEDULE%';
根据以上结果对相应的SQL或等待时间进行优化。
--结束END--
本文标题: 通过dba_hist_*来进行诊断
本文链接: https://lsjlt.com/news/48434.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0