你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle AWR报告生成与查看

[日期:2011-04-09] 来源:Linux社区  作者: 小鹏 [字体:大 中 小]

ash对awr是一种补充,可以以秒为单位对数据采集,收集v$session、v$session_wait的信息。

记录在sysaux表空间中。在内存中的空间大小有_ash_size来配置,最小1m,最大是30m。

 

SYS@PENG SQL> col "parameter" for a30
SYS@PENG SQL> col "instance value" for a30
SYS@PENG SQL> col "session value" for a30

SQSYS@PENG SQL> select a.ksppinm "parameter",
  2         b.ksppstvl "session value",
  3         c.ksppstvl "instance value"
  4  from x$ksppi a ,x$ksppcv b ,x$ksppsv c
  5  where a.indx = b.indx
  6        and a.indx = c.indx
  7        and substr(ksppinm,1,4)='_ash'
  8  ;
 
parameter                      session value                  instance value
------------------------------ ------------------------------ ------------------------------
_ash_sampling_interval  间隔   1000                           1000
_ash_size               大小   1048618                        1048618
_ash_enable             开启   TRUE                           TRUE
_ash_disk_write_enable         TRUE                           TRUE
_ash_disk_filter_ratio         10                             10
_ash_eflush_trigger   释放内存 66                             66
_ash_sample_all       采样类别 FALSE                          FALSE
_ash_dummy_test_param          0                              0
 
8 rows selected
 
SYS@PENG SQL> 

当前ash已经使用的状态,目前已经使用了2m空间。
SYS@PENG SQL> select pool,name,bytes/1024/1024 from v$sgastat where name like 'ASH%';

POOL         NAME                       BYTES/1024/1024
------------ -------------------------- ---------------
shared pool  ASH buffers                              2

SYS@PENG SQL>

ash数据分为两部分,一部分存在sga中,是最近1小时内的数据。可以通过v$ACTIVE_SESSION_HISTORY视图查看。另一部分是过往的数据,可以动过dba_hist_active_sess_history的视图查看。

SYS@PENG SQL>
select to_char(min(sample_time),'yyyy-mm-dd hh24:mi:ss'),to_char(max(sample_time),'yyyy-mm-dd hh24:mi:ss') from v$ACTIVE_SESSION_HISTORY ;

TO_CHAR(MIN(SAMPLE_ TO_CHAR(MAX(SAMPLE_
------------------- -------------------
2010-12-13 01:03:15 2010-12-13 06:31:18

SYS@PENG SQL>

select to_char(min(sample_time),'yyyy-mm-dd hh24:mi:ss'),to_char(max(sample_time),'yyyy-mm-dd hh24:mi:ss') from dba_hist_active_sess_history;

TO_CHAR(MIN(SAMPLE_ TO_CHAR(MAX(SAMPLE_
------------------- -------------------
2010-12-07 00:20:11 2010-12-13 06:28:09

SYS@PENG SQL>

同时可以通过ashrpt.sql脚本生成指定时间段的报告:


ASH Report For PENG/peng

DB Name         DB Id    Instance     Inst Num Release     RAC Host
------------ ----------- ------------ -------- ----------- --- ------------
PENG           620748923 peng                1 10.2.0.4.0  NO  localhost

CPUs           SGA Size       Buffer Cache        Shared Pool    ASH Buffer Size
---- ------------------ ------------------ ------------------ ------------------
   1        160M (100%)        60M (37.5%)        88M (55.0%)        2.0M (1.3%)


          Analysis Begin Time:   13-Dec-10 05:54:11
            Analysis End Time:   13-Dec-10 06:44:14
                 Elapsed Time:        50.1 (mins)
                 Sample Count:         144
      Average Active Sessions:        0.05
  Avg. Active Session per CPU:        0.05
                Report Target:   None specified

Top User Events                    DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                                                               Avg Active
Event                               Event Class     % Activity   Sessions
----------------------------------- --------------- ---------- ----------
CPU + Wait for CPU                  CPU                   2.08       0.00
          -------------------------------------------------------------

Top Background Events              DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                                                               Avg Active
Event                               Event Class     % Activity   Sessions
----------------------------------- --------------- ---------- ----------
Streams AQ: qmn coordinator waiting Other                93.75       0.04
log file parallel write             System I/O            1.39       0.00
          -------------------------------------------------------------

Top Event P1/P2/P3 Values          DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

Event                          % Event  P1 Value, P2 Value, P3 Value % Activity
------------------------------ ------- ----------------------------- ----------
Parameter 1                Parameter 2                Parameter 3
-------------------------- -------------------------- --------------------------
log file parallel write           1.39                   "1","2","1"       0.69
files                      blocks                     requests

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

Top Service/Module                 DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

Service        Module                   % Activity Action               % Action
-------------- ------------------------ ---------- ------------------ ----------
SYS$BACKGROUND UNNAMED                       95.14 UNNAMED                 95.14
SYS$USERS      sqlplus@localhost (TNS V       2.08 UNNAMED                  2.08
SYS$BACKGROUND MMON_SLAVE                     1.39 Auto-Flush Slave A       1.39
          -------------------------------------------------------------

Top Client IDs                     DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top SQL Command Types              DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)
-> 'Distinct SQLIDs' is the count of the distinct number of SQLIDs
      with the given SQL Command Type found over all the ASH samples
      in the analysis period

                                           Distinct            Avg Active
SQL Command Type                             SQLIDs % Activity   Sessions
---------------------------------------- ---------- ---------- ----------
SELECT                                            4       2.78       0.00
          -------------------------------------------------------------

Top SQL Statements                DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top SQL using literals             DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top PL/SQL Procedures              DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top Sessions                      DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)
-> '# Samples Active' shows the number of ASH samples in which the session
      was found waiting for that particular event. The percentage shown
      in this column is calculated with respect to wall clock time
      and not total database activity.
-> 'XIDs' shows the number of distinct transaction IDs sampled in ASH
      when the session was waiting for that particular event
-> For sessions running Parallel Queries, this section will NOT aggregate
      the PQ slave activity into the session issuing the PQ. Refer to
      the 'Top Sessions running PQs' section for such statistics.

   Sid, Serial# % Activity Event                             % Event
--------------- ---------- ------------------------------ ----------
User                 Program                          # Samples Active     XIDs
-------------------- ------------------------------ ------------------ --------
      152,    1      93.75 Streams AQ: qmn coordinator wa      93.75
SYS                  Oracle@localhost (QMNC)          135/3,003 [  4%]        0

      142,  114       2.08 CPU + Wait for CPU                   1.39
SYS                  sqlplus@localhost (TNS V1-V3)      2/3,003 [  0%]        0

      166,    1       1.39 log file parallel write              1.39
SYS                  oracle@localhost (LGWR)            2/3,003 [  0%]        0

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

Top Blocking Sessions              DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top Sessions running PQs          DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top DB Objects                     DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top DB Files                       DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Top Latches                        DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)

                  No data exists for this section of the report.
          -------------------------------------------------------------

Activity Over Time                DB/Inst: PENG/peng  (Dec 13 05:54 to 06:44)
-> Analysis period is divided into smaller time slots
-> Top 3 events are reported in each of those slots
-> 'Slot Count' shows the number of ASH samples in that slot
-> 'Event Count' shows the number of ASH samples waiting for
   that event in that slot
-> '% Event' is 'Event Count' over all ASH samples in the analysis period

                         Slot                                   Event
Slot Time (Duration)    Count Event                             Count % Event
-------------------- -------- ------------------------------ -------- -------
05:54:11   (49 secs)        1 Streams AQ: qmn coordinator wa        1    0.69
05:55:00   (5.0 min)       11 Streams AQ: qmn coordinator wa        9    6.25
                              log file parallel write               1    0.69
                              log file sync                         1    0.69
06:00:00   (5.0 min)       22 Streams AQ: qmn coordinator wa       20   13.89
                              CPU + Wait for CPU                    1    0.69
                              null event                            1    0.69
06:05:00   (5.0 min)       30 Streams AQ: qmn coordinator wa       30   20.83
06:15:00   (5.0 min)       17 Streams AQ: qmn coordinator wa       17   11.81
06:20:00   (5.0 min)        8 Streams AQ: qmn coordinator wa        8    5.56
06:25:00   (5.0 min)       20 Streams AQ: qmn coordinator wa       20   13.89
06:30:00   (5.0 min)       18 Streams AQ: qmn coordinator wa       15   10.42
                              CPU + Wait for CPU                    2    1.39
                              log file parallel write               1    0.69
06:35:00   (5.0 min)        5 Streams AQ: qmn coordinator wa        5    3.47
06:40:00   (4.2 min)       12 Streams AQ: qmn coordinator wa       10    6.94
                              CPU + Wait for CPU                    1    0.69
                              db file sequential read               1    0.69
          -------------------------------------------------------------

End of Report

linux
相关资讯       Oracle教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款