Thursday, 27 June 2013

how to kill process which is running on particular session.

Some time we needs to terminate current process which is running on particular users session.in this process first we find out which process is running on particular session then we first get it id and serial number,through this two attribute we can kill the oracle process.

note:- this process is very important to kill oracle process without any impact.

 Oracle session process kill steps:-


SQL>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';

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';

In a RAC environment, you optionally specify the INST_ID, shown when querying the GV$SESSION view. This allows you to kill a session on different RAC node.

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#,@inst_id';


The KILL SESSION command doesn't actually kill the session. It merely asks the session to kill itself. In some situations, like waiting for a reply
from a remote database or rolling back transactions, the session will not kill itself immediately and will wait for the current operation to complete.
In these cases the session will have a status of "marked for kill". It will then be killed as soon as possible.

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;       


                          *************END*************








No comments:

Post a Comment

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...