Last active
September 23, 2015 08:40
-
-
Save wkoszycki/584c90ffc7bae60e0245 to your computer and use it in GitHub Desktop.
kill blocking session oracle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'ALTER SYSTEM KILL SESSION '''||sid||','|| s.serial#||'''IMMEDIATE;' | |
FROM sys.GV_$LOCKED_OBJECT L | |
, DBA_OBJECTS O | |
, sys.GV_$SESSION S | |
, sys.GV_$PROCESS P | |
WHERE L.OBJECT_ID = O.OBJECT_ID | |
and l.inst_id = s.inst_id | |
AND L.SESSION_ID = S.SID | |
and s.inst_id = p.inst_id | |
AND S.PADDR = P.ADDR(+) | |
order by l.inst_id; | |
SELECT 'ALTER SYSTEM KILL SESSION '''||sid||','|| serial#||'''IMMEDIATE;' FROM v$session WHERE blocking_session is not NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment