Oracle Wait Event 조회 스크립트
select cast(min(sn.begin_interval_time) over (partition by sn.dbid,sn.snap_id) as date) snap_time, --workaround to uniform snap_time over all instances in RAC --ss.dbid, --uncomment if you have multiple dbid in your AWR sn.instance_number, ss.event_name, ss.wait_class, ss.total_waits, ss.time_waited_micro, ss.total_waits - lag(ss.total_waits) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first) Delta_waits, ss.time_waited_micro - lag(ss.time_waited_micro) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first) Delta_timewaited, round((ss.total_waits - lag(ss.total_waits) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first)) / (extract(hour from END_INTERVAL_TIME-begin_interval_time)*3600 -extract(hour from sn.snap_timezone - lag(sn.snap_timezone) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first) )*3600 --deals with daylight savings time change + extract(minute from END_INTERVAL_TIME-begin_interval_time)* 60 + extract(second from END_INTERVAL_TIME-begin_interval_time)),2 ) Waits_per_sec, round((ss.time_waited_micro - lag(ss.time_waited_micro) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first)) / (extract(hour from END_INTERVAL_TIME-begin_interval_time)*3600 -extract(hour from sn.snap_timezone - lag(sn.snap_timezone) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first) )*3600 --deals with daylight savings time change + extract(minute from END_INTERVAL_TIME-begin_interval_time)* 60 + extract(second from END_INTERVAL_TIME-begin_interval_time)),2 ) Rate_timewaited, -- time_waited_microsec/clock_time_sec round((ss.time_waited_micro - lag(ss.time_waited_micro) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first)) / nullif(ss.total_waits - lag(ss.total_waits) over (partition by ss.dbid,ss.instance_number,ss.event_id order by sn.snap_id nulls first),0),2) Avg_wait_time_micro from dba_hist_system_event ss, dba_hist_snapshot sn where sn.snap_id = ss.snap_id and sn.dbid = ss.dbid and sn.instance_number = ss.instance_number and sn.begin_interval_time between sysdate-7 and sysdate order by sn.snap_id |
'1. IT Story > Scripts' 카테고리의 다른 글
Oracle 인덱스 정리 대상 추출 스크립트 (0) | 2019.01.28 |
---|---|
Oracle DB의 OS 상태 조회 스크립트 (0) | 2019.01.27 |
OS(리눅스) 5초단위로 서버 및 DB 상태 출력 스크립트 (0) | 2019.01.24 |
Oracle Alert Log Viewer (11gR2) (0) | 2019.01.19 |
Oracle Rawdevice구성 RMAN Backup스크립트 (0) | 2019.01.15 |
오라클 SQL TRACE 추출 스크립트 (0) | 2019.01.13 |
Oracle DB 기본 점검 스크립트 (0) | 2019.01.10 |
Oracle RMAN FULL BACKUP 스크립트 (0) | 2019.01.09 |