Vous êtes sur la page 1sur 2

Blocking Session SQL

select s1.username || '@' || s1.machine


|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS
blocking_status,l1.id1,l2.id2
from gv$lock l1, gv$session s1, gv$lock l2, gv$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 ;
Regards,
Manoj Kodiyan
650-491-6449
510-402-4766 x 16
------------------------------------------Kompsoft 24x7 support
Phone: 510-402-4766 x 11
Email : support@kompsoft.com

//////////////////////////////

Name=kaoadb_kaoadb1
Type=Database Instance
Host=windb01.fskeenan.com
Metric=Blocking Session Count
KEY_VALUE=SID: 1646 Serial#: 1
Timestamp=Jul 1, 2010 5:57:26 AM PDT
Severity=Warning
Message=Session 1646 is blocking 2 other sessions
Rule Name=Blocking Sessions
Rule Owner=SYS
1. Open cmd prompt and connect to sql sqlplus system/pwd@kaoadb1
2. On sqlplus paste the query given below

select s1.username || '@' || s1.machine


|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS
blocking_status,l1.id1,l2.id2
from gv$lock l1, gv$session s1, gv$lock l2, gv$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 ;
3. If it shows no rows selected then it means that there are no blocking
sessions. It got cleared.
Sometimes clear message does not come but it can be ignored
because we have checked it by running query.

Vous aimerez peut-être aussi