简体   繁体   中英

alter table enable table lock; and ORA-00054

I disabled the lock on a table by mistake using alter table disable table lock clause. Now i want to enable the lock on it because i want to change the table name using the following statment:

SQL> alter table account.acctbk_payment_seq enable table lock; alter table account.acctbk_payment_seq enable table lock * ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

any ideal?

thank you for your reply. ora 1120 for examle:

create table scott.t8 (id number);
alter table scott.t8 disable table lock;
alter table scott.t8 enable table lock;

ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

From Oracle docs:

ENABLE TABLE LOCK Specify ENABLE TABLE LOCK to enable table locks, thereby allowing DDL operations on the table. All currently executing transactions must commit or roll back before Oracle Database enables the table lock.

Note that doesn't say "All currently executing transactions that are using the table ". I am not sure if this really means that there can't be any transactions outstanding in the entire instance, but that could be the case.

Try getting rid of all sessions accessing the database, particularly any that might have a transaction open against this table. If you still get the error, restarting the instance might help.

Update : Sounds like you might need some assistance from Oracle Support. But I did a search on the support website and found some notes about possible reasons for this. There could be an in-doubt distributed transaction touching the table. See if these queries return anything, and if so, you need to resolve these pending transactions:

SELECT * FROM DBA_2PC_PENDING;
SELECT * FROM DBA_2PC_NEIGHBORS;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM