oracle 查询死锁 kill 会话进程
----查询锁死会话进程
select sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo,
dba_objects ao,
v$session sess
where ao.object_id = lo.object_id and lo.session_id = sess.sid ----杀死进程
alter system kill session '2838,38505'
----查询杀死但未释放进程可以通过下列语句查询:
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'
----用root 强制kill 进程如果利用上面的命令杀死一个进程后,进程状态被置为"killed",但是锁定的资源很长时间没有被释放,那么可以在OS级再杀死相应的进程(线程),首先执行下面的语句获得进程(线程)号:
select b.spid,a.osuser,b.program from v$session a,v$process b where a.paddr=b.addr and a.sid=2838