Skip to Main Content
  • Questions
  • Cannot enable table locks - ORA-00054: resource busy

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, 1.

Asked: January 30, 2018 - 1:32 pm UTC

Last updated: February 01, 2018 - 12:59 am UTC

Version: 12.1

Viewed 10K+ times! This question is

You Asked

Hello,

I have one user who has disabled table locks on a table, and now we can't enable lock on this table :

SQL> alter table USER.SOME_TABLE enable table lock;
alter table USER.SOME_TABLE enable table lock
*

ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired Even after restart oracle instance

I have restart oracle database without success.

when i look at v$lock and v$sessions, there no locks and no session opened by this user.

And i can't drop this table.

What can i do please?

and Connor said...

See the docs

https://docs.oracle.com/database/121/SQLRF/statements_3001.htm#SQLRF53524

*Every* transaction on the database must be complete. The database basically must be totally idle.

You can try this:

alter session set ddl_lock_timeout = 300;

and then try again. Now you'll wait up to 5 minutes rather than having a single attempt.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Already tried

A reader, January 31, 2018 - 4:04 pm UTC

Hi,
Thank you for response.

I have already tried this but with no success.

the answer is instantaneous, and is not after 300 seconds of the timeout.

[SYS@XV2DEV12] SQL> alter session set ddl_lock_timeout = 300;

Session modifiée.

[SYS@XV2DEV12] SQL> alter table FALCON_DEV_06_USR.USR_TRANSACTION enable table lock;
alter table FALCON_DEV_06_USR.USR_TRANSACTION enable table lock
*
ERREUR à la ligne 1 :
ORA-00054: ressource occupée et acquisition avec NOWAIT ou temporisation indiqué

No session exist with this user and table is not locked :

[SYS@XV2DEV12] SQL> SELECT username FROM v$session
2 WHERE username = 'FALCON_DEV_06_USR';

aucune ligne sélectionnée

[SYS@XV2DEV12] SQL> select session_id, a.object_id, xidsqn, oracle_username, b.owner owner, b.object_name object_name, b.object_type object_type FROM v$locked_object a, dba_objects b WHERE b.object_id = a.object_id;

[SYS@XV2DEV12] SQL> select session_id, a.object_id, xidsqn, oracle_username, b.owner owner, b.object_name object_name, b.object_type object_type FROM v$locked_object a, dba_objects b WHERE b.object_id = a.object_id and OBJECT_NAME = 'USR_TRANSACTION' and ORACLE_USERNAME = 'FALCON_DEV_06_USR';

aucune ligne sélectionnée
Connor McDonald
February 01, 2018 - 12:59 am UTC

I think you'll need to log a call with Support.

I can't reproduce that on my 12.1 or 12.2 instance. Even the lock wait is a blocking wait, rather than a nowait one (and I have not set ddl_lock_timeout)

DISABLE_TABLE_LOCK

More info

A reader, February 01, 2018 - 6:21 am UTC

Provide the full table desc and related depensencies (jobs triggers etc)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library