select sid,event,p1raw from v$session_wait where event like 'library cache pin%';select sql_text from v$sqlarea where hash_value=(select sql_hash_valu ...
select sid,event,p1raw from v$session_wait where event like 'library cache pin%';
select sql_text from v$sqlarea where hash_value=(select sql_hash_value from v$session where sid=164);
通過以下SQL可以從 x$kglob得到正在pin的對象:
select kglnaown,kglnaobj,kglnadlk from x$kglob where kglhdadr=' 1BD820A8';
找到持有library cache pin以及等待library cache pin的session,看看mode=2的會話在乾什麼(2=share 3=exclusive)
select s.sid, kglpnmod "Mode", kglpnreq "Req", SPID "OS Process"
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;