Oracle&Kill进程
有时候通过Oracle 控制台界面看到会话里面,同一台计算机有很多会话在连接数据库,很多时候可能是因为PL\SQL 异常退出,或者程序代码调用数据库操作。没有释放资源造成
造成的,
SELECT S.USERNAME, S.OSUSER, S.SID, S.SERIAL#, P.SPID
FROM V$SESSION S, V$PROCESS P
WHERE S.PADDR = P.ADDR
AND S.USERNAME IS NOT NULL
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 sid,serial#,username,status
from v$session
where username is not null;
找到sid和serial ,可以KILL进程
alter system kill session 'sid,serial#';
ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' IMMEDIATE;
select b.sid,b.SERIAL#
from SYS.V_$ACCESS a, SYS.V_$session b
where a.type = 'PROCEDURE'
and (a.OBJECT like upper('%INTOFND%') or
a.OBJECT like lower('%INTOFND%'))
and a.sid = b.sid
and b.status = 'ACTIVE';
alter system kill session '156,7';
主要要谨慎,不然数据库可能崩溃
评论区