代码改变世界

oracle 死锁处理

2022-03-17 14:33  tshaoguo  阅读(86)  评论(0编辑  收藏  举报

--查看是否有死锁存在,有数据则代表有死锁
select
p.spid,
o.object_name,
l.session_id,
l.oracle_username,
l.os_user_name
from v$process p,v$session s,v$locked_object l,all_objects o
where p.addr=s.paddr and s.process=l.process and o.object_id=l.object_id;

--查出死锁会话信息【sid为上一步session_id】
select sid, serial#, username, osuser from v$session where sid='13558';


--删除死锁【参数为上一步sid和serial#】
alter system kill session '13558,14982';