[Oracle]-性能优化工具(5)-AWRSQL

2014-11-24 16:16:06 · 作者: · 浏览: 1
  • DB Name
  • DB Id
  • Instance
  • Inst num
  • Startup Time
  • Release
  • RAC
  • TEST11G
  • 977587123
  • test11g
  • 1
  • 23-2月 -14 07:02
  • 11.2.0.1.0
  • NO
  • Snap Id
  • Snap Time
  • Sessions
  • Cursors/Session
  • Begin Snap:
  • 2039
  • 23-2月 -14 15:56:23
  • 28
  • 2.0
  • End Snap:
  • 2040
  • 23-2月 -14 15:56:38
  • 30
  • 1.9
  • Elapsed:
  • 0.24 (mins)
  • DB Time:
  • 0.25 (mins)
  • SQL Id
  • Elapsed Time (ms)
  • Module
  • Action
  • SQL Text
  • 1rrtf60fmhxkj
  • 13,564
  • SQL*Plus
  • SELECT COUNT(*) FROM T1, T2 WHERE T1.OBJECT_ID=T2.OBJECT_ID...
在AWR中定位到问题SQL语句后想要了解该SQL statement的具体执行计划,于是就用AWR报告中得到的SQL ID去V$SQL等几个动态性能视图中查询,但发现V$SQL或V$SQL_PLAN视图都已经找不到对应SQL ID的记录,一般来说这些语句已经从shared pool共享池中被替换出去了。
这个时候我们可以尝试使用DBMS_XPLAN.DISPLAY_AWR存储过程来将 Oracle Automatic Workload Repository自动负载仓库中记录的SQL语句相关信息抽取出来,如:
@ /rdbms/admin/awrsqrpt.sql
下面是上诉语句生成的AWRSQL:

WORKLOAD REPOSITORY SQL Report

Snapshot Period Summary

SQL Summary

Back to Top

SQL ID: 1rrtf60fmhxkj

1st Capture and Last Capture Snap IDs refer to Snapshot IDs witin the snapshot range
SELECT COUNT(*) FROM T1,T2 WHERE T1.OBJECT_ID=T2.OBJECT_ID
Plan Statistics
Execution Plan Back to Top
% Total DB Time is the Elapsed Time of the SQL statement divided into the Total Database Time multiplied by 100
dynamic sampling used for this statement (level=2)