Script for session waitclass statistics

Script for session waitclass statistics summary

set echo off feed off lines 100 pages 999
col sesid format a21 wrap head 'Ses ID'
col wait_class format a11 wrap head 'Wait|Class'
col sumtotwaits format 9,999,990 head 'Sum|Tot|Waits'
col sumtimwaited format 999,999,990 head 'Sum|Time|Waited'
col username format a12 wrap
break on sesid skip 1 on report
compute sum of sumtimwaited on sesid
compute sum of sumtimwaited on report

spool seswaitclassum.lis


select
swc.sid || ',' || swc.serial# || ' ' || s.username sesid,
swc.wait_class,
sum(swc.total_waits) sumtotwaits,
sum(swc.time_waited) sumtimwaited
from
v$session_wait_class swc,
v$session s
where
swc.sid = s.sid and
swc.serial# = s.serial# and
s.username is not null and
swc.wait_class != 'Idle'
group by
swc.sid || ',' || swc.serial# || ' ' || s.username,
swc.wait_class
order by
1, 4 desc
/


spool off
set echo on feed on
clear col
clear break

Comments

Popular posts from this blog

ORA-04062: timestamp of procedure has been changed

ORA-00939: too many arguments -when case arguments exceed 255

ORA-31655: no data or metadata objects selected for job