기본 콘텐츠로 건너뛰기

EVENT SQL MONITORING


-- EVENT MONITORING            
SELECT  EVENT
      , SUM(TIME_WAITED) SUM
      , ROUND(RATIO_TO_REPORT(SUM(TIME_WAITED)) OVER (), 2) AS RATIO
FROM    GV$ACTIVE_SESSION_HISTORY
WHERE   SAMPLE_TIME BETWEEN SYSDATE - 3/1440 AND SYSDATE
GROUP BY
        EVENT
ORDER BY
        SUM DESC
        ;

-- FIND SQL_ID FROM EVENT
SELECT  SQL_ID, EVENT
      , SUM(TIME_WAITED) SUM
      , ROUND(RATIO_TO_REPORT(SUM(TIME_WAITED)) OVER (), 2) AS RATIO
FROM    GV$ACTIVE_SESSION_HISTORY
WHERE   SAMPLE_TIME BETWEEN SYSDATE - 3/1440 AND SYSDATE
AND     EVENT = 'latch: cache buffers chains'
GROUP BY
        SQL_ID, EVENT
ORDER BY
        SUM DESC
;

-- FIND SQL TEXT FROM SQL_ID
SELECT SQL_FULLTEXT
FROM V$SQLAREA
WHERE SQL_ID = '5frpptd8mtvx0'
;


               

댓글

이 블로그의 인기 게시물

sql id 별 AWR SQL Stat History 확인

-- AWR SQL Stat History 확인 with w_sqlstat as (     select /*+ inline use_nl(a,b,c) leading(a) index(a (sql_id))*/            a.*,            to_char(b.begin_interval_time,'mm/dd hh24:mi') snap_time     from   dba_hist_sqlstat a          , dba_hist_snapshot b     where  b.dbid             = a.dbid     and    b.instance_number  = a.instance_number     and    b.snap_id          = a.snap_id     and    a.sql_id = '7s4bffkwdq1r4' --    and    a.module like 'BTmapsc090%' --    and    b.instance_number  = 1 --    and    b.dbid = 3107085369 --    and    a.snap_id >= 15817     --and    b.snap_id = 55925     --and   ...