Author Topic: How To Kill Session In Oracle Using Command In Sqlplus?  (Read 582 times)


  • Sr. Member
  • ****
  • Posts: 423
  • If You Believe You Can, Than You Should Do It.
How To Kill Session In Oracle Using Command In Sqlplus?
« on: April 26, 2015, 04:33:13 PM »
In various critical situations Oracle DBA has to decide to kill existing session or kill the background process of Oracle. At this moment remote Oracle DBA should need to terminate session/process called as murder of session.

Which situation kill session or process needed:

Then question is raised that in under which type of situation remote dba should need to kill session and process. We are explaining those situations and incidences of database.Some critical situation Oracle DBA should need to take decision to ternminate session. 

Kill session needed under following typical and critical circumstances. 

1. When blocking lock occurs and other sessions are waiting to acquire a lock on same object. But blocker session doesn't end the transaction. At this moment Remote oracle dba should need to identify blocking session and terminate it for clearing resources for other sessions.

2. When maximum connections reached error occurs. No room available for any new connection or session. At this time Remote Oracle DBA should need to kill some of idle processes from Oracle database.

3. When database found in hang status and shutdown abort command also doesn't work, at same time Remote Dba should need to terminate instance abnormally with murdering background processes.
In above critical situation we need to kill or terminate or murder some session or process using command line or GUI utility like OEM, TOAD etc. But command line is more easy and helpful to solve such critical situation in remote DBA support services.

How to kill session using command line of Oracle:

Using SQL*Plus (kill session with alter system command): It is very simple way to kill session using SQL command. Just check serial no and sid (system identifier) from v$session view as follows and use "alter system kill session" with sid and serial# command.   SQL>select sid,serial# from v$session where machine='GPTWORKGROUP';

--------- ---------
9 171
1 row selected

SQL> alter system kill session '9,171';
System altered.
SQL>alter system kill session '9,171' immediate;
System altered.

And terminated user session will get message in sqlplus that "your session has been killed". We can get output of status as "killed" from v$session for terminated session.

Jitu Das
Deploma in CSE
Bangladesh Skill Development Institute
Contact Number:+8801620210620