oracle alter table 启用表锁;和 ORA-00054
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5579735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
alter table enable table lock; and ORA-00054
提问by Ssoon
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:
我错误地使用 alter table disable table lock 子句禁用了表上的锁。现在我想启用对它的锁定,因为我想使用以下语句更改表名:
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
SQL> alter table account.acctbk_payment_seq 启用表锁;alter table account.acctbk_payment_seq enable table lock * ERROR at line 1: ORA-00054: 资源繁忙并获取指定的 NOWAIT 或超时过期
any ideal?
任何理想?
thank you for your reply. ora 1120 for examle:
谢谢您的回复。以ora 1120为例:
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
ORA-00054: 资源繁忙并获取指定的 NOWAIT 或超时过期
回答by Dave Costa
From Oracle docs:
来自 Oracle 文档:
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.
ENABLE TABLE LOCK 指定 ENABLE TABLE LOCK 以启用表锁,从而允许对表进行 DDL 操作。所有当前正在执行的事务必须在 Oracle 数据库启用表锁之前提交或回滚。
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:
更新:听起来您可能需要 Oracle 支持部门的帮助。但是我在支持网站上进行了搜索,并找到了一些关于可能原因的说明。可能有一个不确定的分布式事务触及该表。查看这些查询是否返回任何内容,如果是,您需要解决这些待处理的事务:
SELECT * FROM DBA_2PC_PENDING;
SELECT * FROM DBA_2PC_NEIGHBORS;