ORA-04021: timeout occurred while waiting to lock object








VError report:
ORA-04021: timeout occurred while waiting to lock object 
04021. 00000 – “timeout occurred while waiting to lock object %s%s%s%s%s”
*Cause: While waiting to lock a library object, a timeout is occurred.

*Action: Retry the operation later.




V$ACCESS – You can use the V$ACCESS view to see which users have locks on which objects in your database
     SELECT SID, OWNER, OBJECT, TYPE
     FROM V$ACCESS
     WHERE OBJECT = ‘object_name’;
$SESSION_EVENT and V$SESSION_WAIT – use these views to see what Oracle wait events the session(s) are waiting on
     SELECT *
     FROM V$SESSION_EVENT
     WHERE SID = <sid>
     ORDER BY TIME_WAITED DESC;


     SELECT *
     FROM V$SESSION_WAIT
     WHERE SID = <sid>;

V$LOCKED_OBJECT – This view will also help you see who is locking the object

  • December 22, 2015 | 16 views