用如下语句查询锁死的表:
select p.spid,
a.serial#,
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;
其中object_name就是被锁的表名,如图:
一般看日志去查找线索
windows 一般在
【ORACLE_BASE】\admin\【SID】\bdump 路径下
死锁发生后,oracle会杀死其中一个process 进行解锁
查锁,
SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK',
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
FROM v$session s,v$lock l,dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL
杀锁
alter system kill session '25,7357'