在项目中因为多个人同时操作数据库,而有的人忘记了commit 或者rollback,就会产生死锁。而导致无法进行操作。
查找死锁语句:
SELECT dob.OBJECT_NAME Table_Name,
lo.SESSION_ID,
vss.SERIAL#,
vss.action Action,
vss.osuser OSUSER,
vss.machine,
vss.process AP_PID,
VPS.SPID DB_PID,
vps.SPID,
VSS.STATUS
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;
然后:
alter system kill session '1494,54833';