Database 11g

Saturday, March 12, 2016

Killing Session in Windows Using ORA-KILL Utility





> First you have to find out that user sid from v$session.


SQL> select username,sid,serial# from v$session where username='SAM';

USERNAME                  SID      SERIAL#
------------------------------ -----------------------
SAM                                 232       17


> Now find out SPID of the user.


SQL> col username for a9
SQL> col spid for a9
SQL> select s.username,  s.sid,  s.serial#,p.spid, last_call_et,status,to_char(logon_time, 'hh24:mi dd/mm/yy') login_time
     from V$SESSION s,V$PROCESS p where s.PADDR=p.ADDR and s.sid=232;

USERNAME         SID    SERIAL#   SPID      LAST_CALL_ET     STATUS       LOGIN_TIME
-----------------------------------------------------------------------------------------------------------------------
 SAM                       232     17           12008              181                   INACTIVE     10:15 09/03/16


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


C:\Users\oracle> orakill proddb 12008

Kill of thread id 12008 in instance proddb successfully signalled.



> This is the another window where you can observe SAM user is generating the report from employee table
  But sudden his session has been killed for which he faced error ORA-03113.


SQL> show user

    USER is "SAM"

SQL> select * from employee;
     
      EMPNO     ENAME
---------- ---------------------
      2345           TOM
      2345           MARY
      2345           CLERK
      2345           JOHN
      2345           DRCAMO
      2345           RNJIKO
      2345           RNJUMO
      2345           AMDISA
      2345           DRKISO
      2345           CIOTOM
      2345           CMOKES
      2345           CATHY
      2345           KISO
      2345           MKTGEX
      1355           TIXOK
      1345           RAJDBA
      1358           MILLER


ERROR:
ORA-03113: end-of-file on communication channel
Process ID: 12008
Session ID: 232 Serial number: 17


Happy Learning...

No comments:

Post a Comment