FIND & KILL A SESSION

SQL>   SELECT b.tablespace,b.segfile#,b.segblk#,b.blocks,a.sid,a.serial#,a.username,a.osuser, a.status

FROM v$session a,v$sort_usage b WHERE a.saddr = b.session_addr;

TABLESPACE  SEGFILE#    SEGBLK#     BLOCKS  SID   SERIAL#       USERNAME       OSUSER    STATUS

—————-      ———–         ————        ——-      —–     ———            ————–            ——–         ——-

TEMP                     0               5515776        128        76     19519          NI_EXT_STR    nibansal         INACTIVE

TEMP                     0               5456512        128        289    4221            VSL9                  visingh           KILLED

TEMP                     0               5438976        128        290    39365         SCOTT1           NBANSAL        KILLED

TEMP                     0               5456384        128        497    1926             AN13                akaushal         KILLED
The command for killing a session :

SQL> ALTER SYSTEM KILL SESSION ‘ sid,  serial# ‘;     (or)
SQL> ALTER SYSTEM KILL SESSION ‘ sid,  serial# ‘  immediate;

Example:


SQL> ALTER SYSTEM KILL SESSION ‘76,19519’ ;
(or)
SQL> ALTER SYSTEM KILL SESSION ‘76,19519’  IMMEDIATE;
For Windows:        C:>  orakill ORACLE_SID spid

For  UNIX :         $   KILL -9 spid;       (get SPID from V$PROCESS)

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: