Kill Session in Oracle Database

Today, i got interesting issue at client. There is a locked session at Oracle database process, that cause by miss step in our PLSQL program.

I have found some script that can help me to solve this.
Check them out.

/* Formatted on 10/29/2014 12:02:42 PM (QP5 v5.163.1008.3004) */
--This query for object monitoring with locked status
SELECT c.owner,
       c.object_name,
       c.object_type,
       b.sid,
       b.serial#,
       b.status,
       b.osuser,
       b.machine
  FROM --  see code depot for full locking script
       v$locked_object a, v$session b, dba_objects c
 WHERE b.sid = a.session_id AND a.object_id = c.object_id; 

The result of this query is :
Session Monitoring_2
And based on the result, i use below script to kill session that object.

--Script to Kill Session with SQL editor tooles
ALTER SYSTEM KILL SESSION 'SID,SERIAL#' IMMEDIATE; 

--example : 
--ALTER SYSTEM KILL SESSION '493,47' IMMEDIATE; 

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