首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

检测死锁并干掉会话

2012-09-24 
检测死锁并杀死会话beginfor c in (select t3.OBJECT_NAME,t2.SID,t2.SERIAL#,t2.USERNAME,alter system

检测死锁并杀死会话

begin
for c in (select t3.OBJECT_NAME,t2.SID,t2.SERIAL#,t2.USERNAME,'alter system kill session '||chr(39)|| t2.SID||','||t2.SERIAL#||chr(39)||' immediate' as fkill from v$locked_object t1,v$session? t2,all_objects t3
? where t1.SESSION_ID = t2.SID and t3.OBJECT_ID = t1.OBJECT_ID)
loop
??? begin
??? dbms_output.put_line(c.fkill);
??? execute immediate c.fkill;
??? exception
????? when others then null;
????? end;
end loop;
end;

热点排行