如何解决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);
索引已创建。
上一篇: C语言的异常处理教程
推荐阅读
-
图文讲解如何解决App的iOS 7顶部状态栏适配问题
-
快手aauto quicker常见问题及如何解决 aauto quicker详细教程
-
如何解决暴风转码视频翻转 视频翻转教程
-
XP系统设备管理器视频控制器VGA有黄色问号如何解决?
-
XP系统设备管理器视频控制器VGA有黄色问号如何解决?
-
win10系统还原出现Usage Error 10099该如何解决?
-
在arcgis使用python脚本进行字段计算时是如何解决中文问题的
-
Win7看视频时突然出现watchdog.sys蓝屏该如何解决?
-
如何解决springboot读取配置文件的中文乱码问题
-
详解如何解决SSM框架前台传参数到后台乱码的问题