【Oracle系列-锁表与解锁解决方案(大招版)】
--1查看被锁的表
select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;
--2查看那个用户那个进程照成死锁
select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;
--3查看连接的进程
SELECT sid, serial#, username, osuser FROM v$session;
--4常用杀招列表-------------------------------
SELECT ‘alter system kill session ‘‘‘ || ta.sid || ‘,‘ || ta.serial# || ‘‘‘;‘,
‘alter system disconnect session ‘‘‘ || ta.sid || ‘,‘ || ta.serial# || ‘‘‘ immediate;‘,
‘host orakill ‘ || tc.instance_name || ‘ ‘ || tb.spid,
‘kill -9 ‘ || tb.spid,
tb.spid,
ta.osuser,
tb.program,
ta.terminal,
ta.program
FROM v$session ta, v$process tb, v$instance tc
WHERE tb.addr = ta.paddr
AND ta.sid = &yoursid;
--5杀掉进程 sid,serial#(普通杀)
alter system kill session ‘15,245‘;
--6强行中断进程(buff杀)-很好用(造成卡机无响应-直接用)
alter system disconnect session ‘137,212‘ immediate;
--7终极杀(大招杀)
--cd 到系统根目录 c:/ xxx
--orakill oracle_sid os_thread;
--demo c:/orakill orcl 245;
PS:解决问题才是王道.
原文:https://www.cnblogs.com/gushi9908/p/9071548.html