ORA-04021: While Revoking EXECUTE ON Privilege on DBMS_AQ Package (Doc ID 2267643.1)

Last updated on AUGUST 07, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.3 and later
Information in this document applies to any platform.

Goal

Getting the ORA-04021 Error while trying to revoke the DBMS_AQ privilege:

SQL> Revoke EXECUTE ON DBMS_AQ from APPLSYS;

Revoke EXECUTE ON DBMS_AQ from APPLSYS
*
ERROR at line 1:
ORA-04021: timeout occurred while waiting to lock object.

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 changed while in use. 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.

Make sure that any AQ operations for the other schema users are stopped before attempting to revoke the execute privilege

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms