Mutex sleep in database - Oracle Database Script. COLUMN mux format a18 heading 'Mutex Type' trunc; COLUMN loc format a32 heading 'Location' trunc; COLUMN sleeps format 9, 999, 999, 990 heading 'Sleeps'; COLUMN wt format 9, 999, 990.9 heading 'Wait |Time (s)'; SELECT e.mutex_type mux , e.location loc , e.sleeps - nvl(b.sleeps, 0) sleeps , (e.wait_time - nvl(b.wait_time, 0))/1000000 wt FROM DBA_HIST_MUTEX_SLEEP b , DBA_HIST_MUTEX_SLEEP e WHERE b.snap_id(+) = &bid AND e.snap_id = &eid AND b.dbid(+) = e.dbid AND b.instance_number(+) = e.instance_number AND b.mutex_type(+) = e.mutex_type AND b.location(+) = e.location AND e.sleeps - nvl(b.sleeps, 0) > 0 ORDER BY e.wait_time - nvl(b.wait_time, 0) DESC;
COLUMN mux format a18 heading 'Mutex Type' trunc; COLUMN loc format a32 heading 'Location' trunc; COLUMN sleeps format 9, 999, 999, 990 heading 'Sleeps'; COLUMN wt format 9, 999, 990.9 heading 'Wait |Time (s)'; SELECT e.mutex_type mux , e.location loc , e.sleeps - nvl(b.sleeps, 0) sleeps , (e.wait_time - nvl(b.wait_time, 0))/1000000 wt FROM DBA_HIST_MUTEX_SLEEP b , DBA_HIST_MUTEX_SLEEP e WHERE b.snap_id(+) = &bid AND e.snap_id = &eid AND b.dbid(+) = e.dbid AND b.instance_number(+) = e.instance_number AND b.mutex_type(+) = e.mutex_type AND b.location(+) = e.location AND e.sleeps - nvl(b.sleeps, 0) > 0 ORDER BY e.wait_time - nvl(b.wait_time, 0) DESC;