| From: | Steve Adams |
| Date: | 15-May-2001 09:54 |
| Subject: | DBMS_LOCK and enqueue resources |
|
|
You are running out of slots in the enqueue resource table (seen via V$RESOURCE) because you are not releasing the locks on those resources. Locks obtained with DBMS_LOCK.REQUEST need to be released explicitly with DBMS_LOCK.RELEASE. They are not implicitly released on COMMIT as other locks are. For example ...
SQL> var handle varchar2(128);
SQL> exec sys.dbms_lock.allocate_unique('MyLock', :handle);
PL/SQL procedure successfully completed.
SQL> select sys.dbms_lock.request(:handle) from dual;
SYS.DBMS_LOCK.REQUEST(:HANDLE)
------------------------------
0
SQL> select count(*) from v$resource where type = 'UL';
COUNT(*)
----------
1
SQL> commit;
Commit complete.
SQL> select count(*) from v$resource where type = 'UL';
COUNT(*)
----------
1
SQL> select sys.dbms_lock.release(:handle) from dual;
SYS.DBMS_LOCK.RELEASE(:HANDLE)
------------------------------
0
SQL> select count(*) from v$resource where type = 'UL';
COUNT(*)
----------
0
SQL>
So, you need to make a call to DBMS_LOCK.RELEASE whenever one of your objects is
not accepted.
|
![]() |
Whenever I create a new version of an existing object this version is locked so that no one can modify the same object. This is done using the DBMS_LOCK package. Whenever I create a lock an enqueue resource entry is made. If I do not accept this object the lock (and its enqueue resource) is not released. I have certain transactions which have a large number of such unaccepted objects. This causes the error: ORA-00052: "maximum number of enqueue resources exceeded". |