Monday, 12 June 2017

Killing Session using alter session Command

ALTER SYSTEM KILL SESSION


For Single Instance Database:


SELECT S.SID, S.SERIAL#, S.OSUSER, S.PROGRAM FROM V$SESSION S;

ALTER SYSTEM KILL SESSION 'sid,serial#';


For RAC Instances:


SQL> select inst_id,sid,serial# from gv$session where username='SCOTT';

   INST_ID        SID    SERIAL# 
---------- ---------- ---------- 
         1        252 45632

SQL>  alter system kill session '252,45632,1'; 
 alter system kill session '252,45632,1' 
ERROR at line 1: 
ORA-00026: missing or invalid session ID

Now, it works:

SQL>  alter system kill session '252,45632,@1';

System altered.

2 comments:


  1. I can not kill the session, even specifying the instance ID. (oracle 18xe)

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete