Thursday, February 19, 2009

How to Kill Oracle Sessions?

There are two main ways to Kill Oracle User Sessions.
1. Directly the session of User.

ALTER SYSTEM KILL SESSION;

2. Identifying the User Process and kill it.

SELECT b.object_name,c.SERIAL#,a.*
FROM V$LOCKED_OBJECT a,DBA_OBJECTS b,v$session c
WHERE a.object_id = b.object_id
AND a.SESSION_ID = c.SID
order by a.SESSION_ID;


ALTER SYSTEM KILL SESSION 'sid,serial#'

In these cases the session will be "marked for kill". It will then be killed as soon as possible.