Sunday, September 15, 2019

KILL ORACLE SESSION IN WINDOWS



KILL AN ORACLE SESSION FROM WINDOWS 



  • For using ORAKILL utility we should need process id from sqlplus.
  • ORAKILL utility is shipped with Oracle software itself.
  • When we install Oracle software same time ORAKILL also is being installed in ORACLE_HOME\bin folder.
  • It can kill process same as "kill -9" command in Unix/Linux.
  • But one drawback of this utility that is we need process id using sqlplus and from v$process,v$session data dictionary views as follows.


select a.username, b.spid 
from v$session a, v$process b 
where a.paddr = b.addr 
and a.username ='SHOAIB';

USERNAME SPID.
--------             ----
SHOAIB        1786



Now we can kill server process of 1786 of shoaib user using ORAKILL utility from command line of Windows as follows.

C:\> orakill instance_name spid

Example
C:\> orakill ginesys 1786

We will get following message in our command prompt of windows.
"Kill of thread id 1786 in instance GINESYS successfully signalled[sic]."


  • We can use TASKKILL command for terminating instance. 
  • Using tasklist command we can get thread id of Oracle.exe 
  • Using TASKKILL command we can terminate or kill instance in command line as follows.

C:\>tasklist 

Image           Name             PID        Session Name   Session#      Mem Usage
=====          =====           =====   ========        ======== ============
System         Idle Process   0             Console             0                 16 K
oracle.exe                           1786       Console             0                 384,100 K
smss.exe                             836         Console             0                 422 K

C:\>taskkill /pid 1786 /T





Alternate we can stop and start service of Oracle instance using command line option of service as follows.

It can be done using "NET start" and "NET stop" command using instance service name.
C:\>NET STOP "OracleServiceGINESYS"
C:\>NET START "OracleServiceGINESYS"


I hope this will help you :) 

No comments:

Post a Comment

ORA-12519: TNS:no appropriate service handler found error

ORA-12519: TNS: no appropriate service handler found error The real problem lies in the PROCESSES parameter All you need ...