Tuesday, 19 June 2012

script to kill the session when there is a lock on the objects you are working in TOAD or SQLPLUS or sql developer

steps to kill sessions:

step1:we need to see table need to be killed,query to see
     
        select *from dba_dml_locks -->from this query copy the session id to which table we need kill session

 step2: now with the above session id we need to see the sessions table i.e

        select *from v$session where sid in ('above table copied session id');
        ex:select *from v$session where sid in ('81');  -->with this query we get record,from that copy   SID,SERIAL# values

step3:to kill sessions we need to write below query,in which we need to keep the
         above copied   SID,SERIAL#  values.below is the query
     
         alter system kill session 'SID,SERIAL# ';
         ex:alter system kill session '328,33875';

No comments:

Post a Comment