Last active
May 20, 2024 23:56
-
-
Save paulofellix/affe8b3419ae1aadf8ce4c556d6042a4 to your computer and use it in GitHub Desktop.
oracle find lock #database #sql
This file contains hidden or 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 ' || chr(39) || s.sid || ', ' || s.serial# || chr(39) || ' ' || 'immediate'|| ';', s.inst_id, | |
'kill -9 ' || p.spid, s.username, s.module | |
from gv$session s, gv$process p | |
where p.inst_id = s.inst_id | |
and p.addr = s.paddr | |
and s.type <> 'BACKGROUND' | |
and s.sid in ( | |
SELECT DECODE(request, 0, sid, -1) sid | |
FROM gV$LOCK | |
WHERE (id1, id2, TYPE) IN (SELECT id1, id2, TYPE FROM GV$LOCK WHERE lmode = 0) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment