1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWRから待機イベントクラス別DB時間を時系列グラフ化

Posted at

AWR(DBA_HIST*)から待機イベントクラス別のDB時間を抽出して時系列グラフにしたときのSQL。
かなり力技・・・

wait_classes.png

SELECT  runtime     ,
        e.wait_class,
        SUM(e.time_waited)
FROM
        (
                SELECT  e1.snap_id        ,
                        e1.dbid           ,
                        e1.instance_number,
                        e1.EVENT_NAME     ,
                        e1.wait_class     ,
                        (e1.TIME_WAITED_MICRO-e2.time_waited_micro)/1000000 "TIME_WAITED"
                FROM    dba_hist_system_event e1,
                        dba_hist_system_event e2
                WHERE   e1.snap_id            =e2.snap_id+1
                        AND e1.dbid           =e2.dbid
                        AND e1.instance_number=e2.instance_number
                        AND e1.event_id       =e2.EVENT_ID
                        AND e1.DBID           =:dbid
                        AND e1.wait_class    !='Idle'
        ) e,
        (
                SELECT  snap_id        ,
                        dbid           ,
                        instance_number,
                        TO_CHAR(BEGIN_INTERVAL_TIME, 'YY-MM-DD HH24:MI:SS') runtime
                FROM    dba_hist_snapshot
                WHERE   DBID                    =:dbid
                        AND begin_interval_time > :start_time
                        AND begin_interval_time < :end_time
                ORDER BY snap_id DESC
        ) s
WHERE   e.snap_id            =s.snap_id
        AND e.dbid           =s.dbid
        AND e.instance_number=s.instance_number
GROUP BY runtime,
        wait_class
ORDER BY runtime
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?