欢迎投稿

今日深度:

如何解决ORA-00054:resourcebusyandacquirewithNOWAITspecifi

如何解决ORA-00054:resourcebusyandacquirewithNOWAITspecified?,


昨天建索引碰到ORA-00054: resource busy and acquire with NOWAIT specified的问题,花费了很多时间解决。这个报错其实很简单,我碰到的这种情况就是用户对这张表的事务没有提交,导致不能对这种表进行DDL操作(建索引是有DDL操作的)。当然花费的时间主要是在一个坑上,值得注意的是数据库是RAC的,当我kill掉事务还没提交的session时,看不到堵塞了,但建索引还是报这个错,原因是要多RAC的多个节点都要kill才行。下面我们来做个小实验,只是单点的处理,RAC的处理只不过是要连不通的数据库:

session1:(制造堵塞,事务不提交)

SQL> create table tt as select * from dba_objects;

表已创建。

SQL> update tt set object_id = object_id + 1;

已更新49838行。

session2:(建索引报错)

SQL> create index ind_tt_object_id on tt(object_id);

create index ind_tt_object_id on tt(object_id) *

第 1 行出现错误:

ORA-00054: resource busy and acquire with NOWAIT specified

session3:(查出是哪个会话有问题,kill,如果是RAC则需要连多个数据库kill)

SQL> select t2.username, t2.sid, t2.serial#, t2.logon_time

from v$locked_object t1, v$session t2

where t1.session_id = t2.sid

order by t2.logon_time;

USERNAME SID SERIAL# LOGON_TIME

------------------------------ ---------- ---------- --------------

TEST 149 20845 14-4月 -14

SQL> alter system kill session '149,20845';

系统已更改。

session2:(再建索引,就成功了)

SQL> create index ind_tt_object_id on tt(object_id);

索引已创建。

www.htsjk.Com true http://www.htsjk.com/oracle/24446.html NewsArticle 如何解决ORA-00054:resourcebusyandacquirewithNOWAITspecified?, 昨天建索引碰到ORA-00054: resource busy and acquire with NOWAIT specified的问题,花费了很多时间解决。这个报错其实很简单,我碰到的这种情...
评论暂时关闭