Kill session locks.

SELECT VS.USERNAME,
       VS.OSUSER,
       VH.SID LOCKING_SID,
       VS.STATUS STATUS,
       VS.MODULE MODULE,
       VS.PROGRAM PROGRAM_HOLDING,
       JRH.JOB_NAME,
       VSW.USERNAME,
       VSW.OSUSER,
       VW.SID WAITER_SID,
       VSW.PROGRAM PROGRAM_WAITING,
       JRW.JOB_NAME,
'ALTER SYSTEM DISCONNECT SESSION ' || CHR(39) || b.sid || ',' || b.serial# || ',@' || a.INST_ID || chr(39) || ' immediate;' kill_cmd
FROM GV$LOCK VH,
     GV$LOCK VW,
     GV$SESSION VS,
     GV$SESSION VSW,
     DBA_SCHEDULER_RUNNING_JOBS JRH,
     DBA_SCHEDULER_RUNNING_JOBS JRW
WHERE     (VH.ID1, VH.ID2) IN (SELECT ID1, ID2
 FROM GV$LOCK
 WHERE REQUEST = 0
 INTERSECT
 SELECT ID1, ID2
 FROM GV$LOCK
 WHERE LMODE = 0)
 AND VH.ID1 = VW.ID1
 AND VH.ID2 = VW.ID2
 AND VH.REQUEST = 0
 AND VW.LMODE = 0
 AND VH.SID = VS.SID
 AND VW.SID = VSW.SID
 AND VH.SID = JRH.SESSION_ID(+)
 AND VW.SID = JRW.SESSION_ID(+);
SQL

Leave a Reply

Your email address will not be published. Required fields are marked *

search previous next tag category expand menu location phone mail time cart zoom edit close