Quantcast
Channel: SCN : Discussion List - SAP on Oracle
Viewing all articles
Browse latest Browse all 1892

DB01 Locks History : ASH

$
0
0

I am investigating row lock contention issue in one of our PROD systems.

 

i have been checking DBA_HIST_ACTIVE_SESS_HISTORY and GV$ACTIVE_SESSION_HISTORY, and observed a column BLOCKING_SESSION.


does BLOCKiNG_SESSION displays the session holding the lock or it displays the sessions waiting due to lock?


because, the description of BLOCKING_SESSION column on Oracle Docs is as follows.


Session identifier of the blocking session. Populated only when the session was waiting for enqueues or a "buffer busy" wait.


The second statement "Populated only when the session was waiting for enqueues" is confusing me.


any expert opinions on it ?


how to find out, which session is holding the locks ?


I have written a sample query to find out, but i want to know the list of sessions holding the locks.

any tweaks for my query ?


any recommendations will help me a lot


The query i used is below.


SELECT DISTINCT A.SQL_ID,TO_CHAR(A.SAMPLE_TIME,'YYYY-MM-DD HH24:MI:SS') SAMPLE_TIME,A.BLOCKING_SESSION,D.OBJECT_NAME,S.SQL_TEXT

FROM DBA_HIST_ACTIVE_SESS_HISTORY A, GV$SQL S, DBA_OBJECTS D

WHERE A.SQL_ID=S.SQL_ID

AND BLOCKING_SESSION IS NOT NULL

AND A.USER_ID <> 0

AND A.CURRENT_OBJ# = D.OBJECT_ID

AND A.SAMPLE_TIME BETWEEN

TO_TIMESTAMP('12.05.2015 00:00:00', 'dd.mm.yyyy hh24:mi:ss') AND

TO_TIMESTAMP('12.05.2015 23:59:59', 'dd.mm.yyyy hh24:mi:ss')

AND A.EVENT = 'enq: TX - row lock contention'

ORDER BY

SAMPLE_TIME DESC


Viewing all articles
Browse latest Browse all 1892

Trending Articles