oracle查询解决死锁网上有很多教程,基本说的很明白了,我只是照做并记录一下我的注释
select username,lockwait,status,machine,program from v$session where sid in
(select session_id from v$locked_object)
-- 166345535 106259895
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object))
SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,
l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS
FROM V$LOCKED_OBJECT l,V$SESSION S WHERE l.SESSION_ID=S.SID;
alter system kill session '136(SESSIONID),10380(SERIAL)';
select a.spid,b.sid,b.serial#,b.username
from v$process a,v$session b
where a.addr=b.paddr
and b.status='KILLED';
select b.spid,a.osuser,b.program
from v$session a,v$process b
where a.paddr=b.addr
and a.sid=136
最后
在OS级别中杀死该进程
a. unix系统,以root身份执行以下命令
?# kill -9 &spid(即第4步查询出来的进程号spid)
?b. windows系统,用orakill命令执行
语法为:orakill? sid thread
sid: oracle实例名
thread 线程号,即第4步中的spid
eg: c:> orakill orcl 12345