Notifications
Clear all

[Solved] How to see locked sessions in ORACLE

1 Posts
1 Users
4 Reactions
1,024 Views
2
Topic starter

How to see locked sessions in ORACLE ?

1 Answer
2
Topic starter

Tatiana Ivanova suggested to invoke the following sql:

select s1.username || '@' || s1.machine
    || ' ( SID=' || s1.sid || ' )  is blocking '
    || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status,
    st.sql_text

    from v$lock l1, v$session s1, v$lock l2, v$session s2, v$sqltext_with_newlines st

    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 st.address = hextoraw(s2.sql_address)
    and st.hash_value = s2.sql_hash_value
order by 1, st.piece    ;