排查和解决oracle死锁语句速查 Oracle死锁
- 创建时间:2024-03-24 / 最新修改时间:2024-03-24 14:10:17
- 605
- 0
转载请注明本文出处:http://limpire.cn/artifact/programming/db/231.html
排查和解决oracle死锁语句速查
-- 查看死锁 session id
select username,lockwait,status,machine,program from v$session where sid
in (select session_id from v$locked_object)
-- 查看死锁详细表
SELECT object_name, machine, s.sid, s.serial#
FROM gv$locked_object l, dba_objects o, gv$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid;
-- 查看导致死锁语句 sid,serial
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object));
-- 结束死锁 sid,serial#
alter system kill session '870,43180'