1.若目前系统中有很多library cache bin, 查看哪些session正在占用
--持有library cache pin的session
select
w.sid, kglpnmod "LockMode", kglpnreq "ReqMode", spid "OSProcess"
from
v$session_wait w, x$kglpn p, v$session s, v$process o
where
p.kglpnuse = s.saddr
and
kglpnhdl = w.p1raw
and
w.event
like
'%library cache pin%'
and
s.paddr = o.addr;
2. 解释
1. mode 2的跟mode 2的共享
2. mode 2, 然后mode 3 ,然后 后续的mode2+mode3都会被堵塞
3. 查一个session目前或上一次运行的hash
select decode(sql_hash_value , 0 , pre_hash_value, sql_hash_value) from v$session where sid =&sid;