Friday, January 24, 2014

Kill session on specific node of RAC

How to kill a user session on specific node of Oracle RAC


SQL> select INST_ID,  username, sid, serial#, osuser, status from gv$session where username in ('TEST');

   INST_ID USERNAME       SID    SERIAL# OSUSER          STATUS
---------- ----------- ------ ---------- --------------- --------
         1 TEST           597       1901 oraem           ACTIVE
         8 TEST           695       5391 oradba          ACTIVE

2 rows selected.

When we try to kill the session as we do in a single instance database it throws a error.

SQL> alter system kill session '695,5391' immediate;
alter system kill session '695,5391' immediate
*
ERROR at line 1:
ORA-00030: User session ID does not exist.


Solution: We need to provide the Instance ID along with the kill session command. i.e.

alter system kill session 'SID,SERIAL#,@<INST_ID>' immediate;

SQL> alter system kill session '695,5391,@8' immediate;

System altered.

Elapsed: 00:00:07.02
SQL> select INST_ID,  username, sid, serial#, osuser, status from gv$session where username in ('TEST');

   INST_ID USERNAME       SID    SERIAL# OSUSER          STATUS
---------- ----------- ------ ---------- --------------- --------
         1 TEST           597       1901 oraem           ACTIVE

1 row selected.

No comments:

Post a Comment