alter table enable table lock; and ORA-00054

拜拜、爱过 提交于 2019-12-25 00:44:17

问题


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


回答1:


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;


来源:https://stackoverflow.com/questions/5579735/alter-table-enable-table-lock-and-ora-00054

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!