environment:HP-UX B.11.31 U ia64 (ta) ORACLE 10.2.0.4 three nade rac (frist node)
symptom:用户反映测试缓慢 OEM中查看各项指标越来越高
查询数据库等待事件 发现有N多 library cache lock ,锁住了其中的一个表
select b.INST_ID ,a.event, b.sid,b.SERIAL#,b.PADDR,b.OSUSER,b.PROGRAM, a.wait_class, c.opname from
gv$session_wait a,
gv$session b,
gv$session_longops c
where a.event in ('db file scattered read','latch free','enqueue',
'library cache lock','library cache pin','cursor: pin S wait on X') and a.sid=b.sid and a.inst_id=b.INST_ID and a.sid=c.SID;
尝试去查是哪个session lock住了这个表,无法查询到 所以使用的一个暴力的解决办法
SELECT s.*,p.*, decode(s.username,NULL,NULL,'alter system kill session '||''''||s.sid ||','||
s.serial# ||'''' ||'; ') kill_session,'kill -9 '||p.spid oskill
FROM v$process p,v$session s
WHERE p.addr = s.paddr
AND s.event <> 'library cache lock' AND s.username IS NOT NULL;
杀掉所有wait event <>'library cache lock'的session 问题解决!!
生产系统请谨慎使用。 不过这种办法的确比重启数据库快