1、找到正在执行的存储过程的 sid,serial#
select b.sid,b.SERIAL#,a.OBJECT,'alter system kill session ' || '''' || b.sid || ',' ||b.SERIAL# || ''';' kill_command
from SYS.V_$ACCESS a,SYS.V_$session b
where a.type = 'PROCEDURE'
and (a.OBJECT like upper('%存储过程名%') or
a.OBJECT like lower('%存储过程名%'))
and a.sid = b.sid
and b.status = 'ACTIVE';
2、Kill 正在执行的存储过程
alter system kill session 'sid,SERIAL#';
select name from v$db_object_cache where locks > 0 and pins > 0 and type='PROCEDURE';
4、找到正在执行的包的 sid,serial#
select b.sid,SYS.V_$session b
where a.type = 'PACKAGE'
and a.sid = b.sid
and b.status = 'ACTIVE';
查询出来的结果就是有死锁的session了,
下面就是杀掉
拿到上面查询出来的SID和SERIAL#,填入到下面的语句中
altersystemkillsession'sid,serial#';
转自:http://blog.csdn.net/rfb0204421/article/details/7587554