Tuesday, February 3, 2015

Find and Kill Oracke database Process at OS Side


session with OS process number


SET LINESIZE 100
COLUMN spid FORMAT A10
COLUMN username FORMAT A10
COLUMN program FORMAT A45

SELECT s.inst_id,
       s.sid,
       s.serial#,
       p.spid,
       s.username,
       s.program
FROM   gv$session s
       JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE  s.type != 'BACKGROUND' ;



Second is for killing on db side


select 'ALTER SYSTEM KILL SESSION '||''''||s.sid||','||s.serial#||',@'||s.inst_id||''' IMMEDIATE;' FROM   gv$session s   JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE  s.type != 'BACKGROUND' and s.username='USERNAME';




No comments:

Post a Comment