Co2y's Blog

oracle关闭释放不掉的存储过程

Oracle层:

1
2
3
4
5
select * from v$db_object_cache where locks > 0 and pins > 0 and type='PROCEDURE';
select b.sid,b.SERIAL# from SYS.V_$ACCESS a, SYS.V_$session b
where a.type = 'PROCEDURE' and (a.OBJECT like upper('%xxx%')
or a.OBJECT like lower('%xxx%')) and a.sid = b.sid and b.status = 'ACTIVE';
alter system kill session 'sid,SERIAL';

OS层:

1
2
3
SELECT P.SPID, S.SID, S.SERIAL#, S.USERNAME, S.PROGRAM FROM V$PROCESS P, V$SESSION S
WHERE P.ADDR=S.PADDR AND S.STATUS='KILLED';
kill9 $SPID