oracle查询并解除死锁的方法

1.使用用sys用户,dba的身份登录

2.查询死锁的语句:

SELECT A.OWNER,
A.OBJECT_NAME,
B.XIDUSN,
B.XIDSLOT,
B.XIDSQN,
B.SESSION_ID,
B.ORACLE_USERNAME,
B.OS_USER_NAME,
B.PROCESS,
B.LOCKED_MODE,
C.MACHINE,
C.STATUS,
C.SERVER,
C.SID,
C.SERIAL#,
C.PROGRAM
FROM ALL_OBJECTS A,
V$LOCKED_OBJECT B,
SYS.GV_$SESSION C
WHERE (A.OBJECT_ID=B.OBJECT_ID)
AND (B.PROCESS=C.PROCESS)
ORDER BY 1,2

3.解除死锁的语句

alter system kill session 'SID,SERIAL#'(PS:第二个字段的#和SERIAL的组合是一个字段,执行时要把#去掉)

如:alter system kill session '149,1773'这种写法

你可能感兴趣的:(oracle查询并解除死锁的方法)