How to find blocking / locking session details:
set lines 145
col sid noprint
select distinct
s1.sid,s1.username || '@' || s1.machine ||
' ( INST=' || s1.inst_id || ' SID=' || s1.sid||','||s1.serial# ||' '||s1.status||': '||s1.last_call_et||' SQLID: '||s1.sql_id||' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( INST=' || s1.inst_id || ' SID=' || s2.sid || ' ) ' AS blocking_status
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
and l1.inst_id = s1.inst_id
order by s1.sid;
Output:
BLOCKING_STATUS
-------------------------------------------------------------------------------------------------------------------------------------------------
APPS@mydbserver ( INST=1 SID=6323,26775 ACTIVE: 2494 SQLID: 08pfumd9shm53 ) is blocking APPS@mydbserver ( INST=1 SID=6323 )
1 row selected.
SQL>
set lines 145
col sid noprint
select distinct
s1.sid,s1.username || '@' || s1.machine ||
' ( INST=' || s1.inst_id || ' SID=' || s1.sid||','||s1.serial# ||' '||s1.status||': '||s1.last_call_et||' SQLID: '||s1.sql_id||' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( INST=' || s1.inst_id || ' SID=' || s2.sid || ' ) ' AS blocking_status
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
and l1.inst_id = s1.inst_id
order by s1.sid;
Output:
BLOCKING_STATUS
-------------------------------------------------------------------------------------------------------------------------------------------------
APPS@mydbserver ( INST=1 SID=6323,26775 ACTIVE: 2494 SQLID: 08pfumd9shm53 ) is blocking APPS@mydbserver ( INST=1 SID=6323 )
1 row selected.
SQL>
No comments:
Post a Comment