Oracle Articles, Oracle Tools, Oracle Tips, Database Articles and DBA Tips  

The Largest Online Resource for Oracle Articles, Oracle Tips, Oracle Scripts & Oracle Tools!!


Enter your Email:
 
Navigate at FreeMegaZone Home      Articles      Tools      Jobs      Games      Support      Submit Content      Advertise
Advertise at www.articles.freemegazone.com

Advertise at FreeMegaZone

Give tremendous boost to your business by advertising at FreeMegaZone. Contact webmaster@freemegazone.com

 

Rating: ****                                               Rate this article:    

 Author:  Don Burleson

Page: 1 2

One of the most common mistakes done by most Oracle database administrators is killing the wrong session. Every database administrator must carefully review the session before killing it. The process and SQL associated with the offensive task must also be analyzed. The database administrator may decide to view the SQL being executed by the session before killing the session.

Killing session with Oracle is a challenge for every database administrator. Many different procedures exist within Windows and UNIX for this purpose.

Killing Oracle Sessions:

You can follow below steps to kill an Oracle session.

  • Gather session information from Oracle
  • Kill the session at the operating system level
  • You can kill the session within Oracle using the "alter system kill session" command in SQL*Plus. First you have to identify the session to be killed.

SELECT s.sid,
s.serial#,
s.osuser,
s.program
FROM v$session s;

SID SERIAL# OSUSER PROGRAM
-----------------------------
1 1 SYSTEM ORACLE.EXE
2 1 SYSTEM ORACLE.EXE
3 1 SYSTEM ORACLE.EXE
4 1 SYSTEM ORACLE.EXE
5 1 SYSTEM ORACLE.EXE
6 1 SYSTEM ORACLE.EXE
20 60 SYSTEM DBSNMP.EXE
43 11215 USER1 SQLPLUSW.EXE
33 5337 USER2 SQLPLUSW.EXE

The SID and SERIAL# values of the relevant session can then be substituted.

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';

Sometimes Oracle.exe is not able to kill the session immediately and the session will be ‘marked for kill'. It will then be killed as soon as possible.

It is possible to force the kill by adding the IMMEDIATE keyword:

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;

  • For killing sessions in UNIX you have to locate the Server PID (SPID) from v$process and issue the UNIX kill -9 command.

% kill -9 spid

Incase of doubt you can check that the SPID matches the UNIX PROCESSID by using below command.

% ps -ef | grep ora

The session thread should be killed immediately and all resources released. Continued...

Page: 1 2

 More Oracle Articles, Database Articles and DBA Tips
   Database Security: Step by step guideline
   Oracle: A Guide to determine Best Execution Plan
   Expert Tips on Drop Temporary Tablespace Hangs!!
   Important Oracle Issues and Solutions: A Must Read!!
   A Quick Guide to determine Oracle RAM Size!!


 

 
HOME      ABOUT US      SUPPORT      SITE MAP      PRIVACY POLICY      TERMS OF USE      SUBMIT CONTENT      ADVERTISE
Copyright © 2007 - 2012 Oriole Intellect Inc. All rights reserved.

The name Oracle is a trademark of Oracle Corporation. Any other names used on this website may be trademarks of their respective owners