ITPub博客

首页 > 数据库 > Oracle > oracle awrsqrpt.sql 脚本使用方法

oracle awrsqrpt.sql 脚本使用方法

Oracle 作者:kunlunzhiying 时间:2016-03-30 17:40:23 0 删除 编辑
ORACLE_HOME/RDBMS/admin/awrsqrpt.sql 
这个脚本可以很方便地取出某个sql在某两个快照间隔内,消耗cpu时间,执行次数,逻辑读,物理读,sql的执行计划以及sql的full sql text,对调优非常方便


以下是个例子

 

WORKLOAD REPOSITORY SQL Report

Snapshot Period Summary

DB Name         DB Id    Instance     Inst Num Startup Time    Release     RAC
------------ ----------- ------------ -------- --------------- ----------- ---
test          45999999989  test           1 18-May-14 00:45 11.2.0.3.0  NO

              Snap Id      Snap Time      Sessions Curs/Sess
            --------- ------------------- -------- ---------
Begin Snap:     11707 09-Jul-14 10:00:47     1,266      38.1
  End Snap:     11708 09-Jul-14 11:00:02     1,496      40.0
   Elapsed:               59.25 (mins)
   DB Time:            4,576.15 (mins)

SQL Summary                     DB/Inst: test/test  Snaps: 11707-11708

                Elapsed
   SQL Id      Time (ms)
------------- ----------
1agdrb19sf1f2 8.5506E+07
Module: JDBC Thin Client
select * from table where id='123456'

          -------------------------------------------------------------

SQL ID: 1agdrb19sf1f2           DB/Inst:test/test  Snaps: 11707-11708
-> 1st Capture and Last Capture Snap IDs
   refer to Snapshot IDs witin the snapshot range
-> select vrycjsqlis0_.SQ_ID as SQ1_478_, vrycjsqlis0_.RYXH as RYXH478_, ...

    Plan Hash           Total Elapsed                 1st Capture   Last Capture
#   Value                    Time(ms)    Executions       Snap ID        Snap ID
--- ---------------- ---------------- ------------- ------------- --------------
1   1091025147             85,505,996        2,3286         11708          11708
          -------------------------------------------------------------


Plan 1(PHV: 1091025147)
-----------------------

Plan Statistics                 DB/Inst: test/test  Snaps: 11707-11708
-> % Total DB Time is the Elapsed Time of the SQL statement divided
   into the Total Database Time multiplied by 100

Stat Name                                Statement   Per Execution % Snap
---------------------------------------- ---------- -------------- -------
Elapsed Time (ms)                        8.5506E+07        3,672.0    31.1
CPU Time (ms)                            3.0166E+07        1,295.5    37.6
Executions                                   23,286            N/A     N/A
Buffer Gets                                       0            0.0     0.0
Disk Reads                                        0            0.0     0.0
Parse Calls                                   5,470            0.2     0.1
Rows                                        124,801            5.4     N/A
User I/O Wait Time (ms)                           0            N/A     N/A
Cluster Wait Time (ms)                            0            N/A     N/A
Application Wait Time (ms)                        0            N/A     N/A
Concurrency Wait Time (ms)                   17,775            N/A     N/A
Invalidations                                     0            N/A     N/A
Version Count                                     3            N/A     N/A
Sharable Mem(KB)                                113            N/A     N/A
          -------------------------------------------------------------

Execution Plan
------------------------------------------------------------------------------------
| Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |                |       |       |    35 (100)|          |
|   1 |  TABLE ACCESS FULL| test |     1 |  3282 |    35   (0)| 00:00:01 |
------------------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement (level=2)

 

Full SQL Text

SQL ID       SQL Text
------------ -----------------------------------------------------------------
1agdrb19sf1f select * from test
        
          
       
   


 



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28211342/viewspace-2072564/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
IT搬砖

注册时间:2014-07-28

  • 博文量
    665
  • 访问量
    321880