oracle死锁处理方法
招数一:
1. 查看被锁的表:
2. select
p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name
from v$process p,v$session a, v$locked_object b,all_objects
c where p.addr=a.paddr and a.process=b.process and
c.object_id=b.object_id
3.
4. 解锁:
5. alter system kill session ‘146‘;(其中146为锁住的进程号)
招数二:
1. SELECT sn.username, m.SID,sn.SERIAL#, m.TYPE,
2. DECODE (m.lmode,
3. 0, ‘None‘,
4. 1, ‘Null‘,
5. 2, ‘Row Share‘,
6. 3, ‘Row Excl.‘,
7. 4, ‘Share‘,
8. 5, ‘S/Row Excl.‘,
9. 6, ‘Exclusive‘,
10. lmode, LTRIM (TO_CHAR (lmode, ‘990‘))
11. ) lmode,
12. DECODE (m.request,
13. 0, ‘None‘,
14. 1, ‘Null‘,
15. 2, ‘Row Share‘,
16. 3, ‘Row Excl.‘,
17. 4, ‘Share‘,
18. 5, ‘S/Row Excl.‘,
19. 6, ‘Exclusive‘,
20. request, LTRIM (TO_CHAR (m.request, ‘990‘))
21. ) request,
22. m.id1, m.id2
23. FROM v$session sn, v$lock m
24. WHERE (sn.SID = m.SID AND m.request != 0) --存在锁请求,即被阻塞
25. OR ( sn.SID = m.SID --不存在锁请求,但是锁定的对象被其他会话请求锁定
26. AND m.request = 0
27. AND lmode != 4
28. AND (id1, id2) IN (
29. SELECT s.id1, s.id2
30. FROM v$lock s
31. WHERE request != 0 AND s.id1 = m.id1
32. AND s.id2 = m.id2)
33. )
34. ORDER BY id1, id2, m.request;
35.
36. alter system kill session ‘91‘;
37. alter system kill session ‘144,633‘;
38. alter system kill session ‘91,21‘;
39. alter system kill session ‘112,5772‘;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。