Latches - Show Statistics
--File Name: latches.sql
--Purpose:   Report Latch Statistics

column name format A40
column gets format 99999999999
column misses format 99999999
column miss_ratio format 9999.99999
column sleeps format 9999999
column immediate_gets format 99999999
column immediate_misses format 99999999
set pagesize 100
select name,
       gets,
       misses,
       decode(misses,0,0,misses/gets) as miss_ratio,
       sleeps,
       immediate_gets "IM_GETS",
       immediate_misses "IM_MISS"
from v$latch
order by name;


/* lru latches
if experiencing lru contention
set db_block_lru_latches=number of cpu
*/