Tuesday 19 November 2013

How to kill a Oracle database session

This post to help Apps developers to kill the blocked session in the lower instances without waiting for DBA.

For production executions please contact your DBA's

Run the following query:


select sid, serial#, username, status, server
  from v$session;

       SID    SERIAL# USERNAME                       STATUS   SERVER
---------- ---------- ------------------------------ -------- ---------
        23         38                                ACTIVE   DEDICATED
        25          1                                ACTIVE   DEDICATED
        26      10516 SYSTEM                         ACTIVE   DEDICATED
        29         93 SRINI02                         ACTIVE   DEDICATED


Findout the session and kill by passing the SID, SERIAL# combination.

Example:

alter system kill session '29, 93';
 
Example:
 
select 'Alter system kill session ''' || sid || ','|| serial# ||''''||';' "session" , process from v$session
where sid='&sid'; 

No comments:

Post a Comment