快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

通过dba_hist_*来进行诊断

在Oracle10g中增加了dba_his_*类统计信息表,在瓶颈时间过时了的时候,可以参考这些表来诊断瓶颈来源。

创新互联成立与2013年,先为城口等服务建站,城口等地企业,进行企业商务咨询服务。为城口企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

1、确定时间段:

select * from dba_hist_snapshot

where snap_idbetween&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或等待时间进行优化。


分享标题:通过dba_hist_*来进行诊断
文章网址:http://6mz.cn/article/gssoie.html

其他资讯