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;
检测死锁并杀死会话
最新推荐文章于 2021-04-04 11:10:43 发布