@@header

/* 
   Library Cache Pin/Lock Pile Up hangs the application 
*/

SELECT s.inst_id
     , s.SID
     , kglpnmod "Mode"
     , kglpnreq "Req"
     , SPID "OS Process"
     , s.program
FROM gv$session_wait w
   , sys.x$kglpn p
   , gv$session s 
   , gv$process o
WHERE p.kglpnuse = s.saddr
and p.inst_id  = s.inst_id
AND p.kglpnhdl = w.p1raw
AND w.event LIKE '%library cache lock%'
and w.sid = s.sid
and w.inst_id = s.inst_id
and s.inst_id = o.inst_id
AND s.paddr=o.addr
;


@@footer