Return to Snippet

Revision: 68057
at November 21, 2014 20:15 by Igeco


Updated Code
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' )  is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;

------------------------------------------------------------------

alter system kill session '<sid>,<serial#>' immediate ;

Revision: 68056
at November 19, 2014 21:12 by Igeco


Initial Code
select s1.username || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' )  is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;

------------------------------------------------------------------

alter system kill session �<sid>,<serial#>� immediate ;

Initial URL

                                

Initial Description
La première commande liste les sessions bloquantes, la deuxième les kill

Initial Title
Find a blocking session and kill it

Initial Tags
Oracle

Initial Language
SQL