Thursday, January 17, 2008

Oracle: How to kill an oracle process in an Linux Operating System

The first thing you should do is to identify the process that you will kill by issuing a sql command like this

col program for a50
set lines 1000
SELECT s.inst_id,
s.sid,
p.spid,
s.osuser,
s.program,
p.inst_id,
p.addr , s.paddr
FROM gv$process p,
gv$session s
WHERE p.addr = s.paddr
and s.inst_id = p.inst_id


after issuing it will somewhat look like this

INST_ID SID SPID
---------- ---------- ------------
1 298 26066
1 299 26070
3 303 5854
1 304 26078
1 303 26082
3 125 6025
1 306 26084
3 304 6029


(please use v$ and not gv$ if you are not using a RAC configured DB and omit the column INST_ID in your query)


so choose the spid(for example you choose spid 6029) you want and go to the linux console and issue

$> kill -9 6029

that's it you have killed an oracle process through a linux command line

No comments: