-- ********************************************************************
-- * Copyright Notice : (c)2000,2001,2002,2003 OraPub, Inc.
-- * Filename : latch.sql
-- * Author : Craig A. Shallahamer
-- * Original : 17-AUG-98
-- * Last Update : 13-Jul-03
-- * Description : Latch contention information for tuning for O9i+
-- * Usage : start latch.sql
-- * Thanks Thanks to Ghassan Salem for creating more
-- * pct_impact effeciant and precise SQL.
-- ********************************************************************
def osm_prog = 'latch.sql'
def osm_title = 'Latch Contention Report'
start osmtitle
set linesize 110
col lname heading "Latch Name" form A24 trunc
col wtime heading "Wait Time|(sec)" form 99,999,990
col pct_impact heading "%Impt" form 990.0
col impact heading "Impact" form 999990.00
col gts heading "Gets(k)" form 999999990
col mss heading "Misses" form 999999990
col hit_ratio heading "Hit Ratio" form 0.000
col slps heading "Sleeps|(k)" form 9990
col mss heading "Misses" form 999999990
col slpsgets heading "Sleeps/|Gets" form 90.000
select name lname,
wait_time/1000000 wtime,
((sleeps*(sleeps/decode(gets,0,1,gets)))/(sum(sleeps*(sleeps/decode(gets,0,1,gets))) over ()))*100 pct_impact,
sleeps*(sleeps/decode(gets,0,1,gets)) impact,
gets/1000 gts,
misses mss,
round((gets-misses)/decode(gets,0,1,gets),3) hit_ratio,
sleeps/1000 slps,
round(sleeps/decode(gets,0,1,gets),3) slpsgets
from v$latch
where sleeps*(sleeps/decode(gets,0,1,gets)) 0.0
order by impact desc, hit_ratio, gets desc, misses desc, name
/
start osmclear