轻松解决Oracle死锁

各位在使用Oracle的过程中,偶尔会遇到死锁问题,运用下面两条语句即可轻松解决。
-- 查询死锁情况
  SELECT dob.OBJECT_NAME Table_Name,
         vss.SID,
         vss.SERIAL#,
         vss.action Action,
         vss.osuser OSUSER,
         vss.process AP_Process_ID,
         VPS.SPID DB_Process_ID,
         VSS.STATUS,
         VSS.STATE
    FROM v$locked_object lo,
         dba_objects dob,
         v$session vss,
         V$PROCESS VPS
   WHERE lo.OBJECT_ID = dob.OBJECT_ID
     AND lo.SESSION_ID = vss.SID
     AND VSS.paddr = VPS.addr
ORDER BY 2, 3, DOB.object_name;

-- 根据上一步查到的sid,SERIAL#,执行下面这段话
alter system kill session 'sid,SERIAL#';

你可能感兴趣的:(oracle,dead lock)