OERR: ORA 4021 time-out occurred while waiting to lock object

来源:互联网 发布:qq空间域名申请 编辑:程序博客网 时间:2024/05/29 17:57

Purpose
Provide OERR information for ORA-4021.

Details
Error:  ORA 4021
Text:   time-out occurred while waiting to lock object <name>
-------------------------------------------------------------------------------
Cause:  While trying to lock a library object, a time-out occurred.
Action: Retry the operation later.

Explanation:
This is locking error where Oracle uses a piece of memory which is shareable among all the database users calling the Library Cache. This  maintains information about objects such as pl/sql packages, views, tables, etc.The object cannot be change while in used.  In order to modify the object, there is a lock in the library cache.  A session will wait on the library cache as the object is in use.  Until the lock is released, the error ora-4021 error.
Diagnosis:
Retry the process as the lock may be released.  Or kill the process holding the lock.   Check V$ACCESS for users of the object:

SELECT SID, OWNER, OBJECT, TYPE
              FROM V$ACCESS
              WHERE OBJECT = 'object_name';