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

来源:互联网 发布:warframe漂亮捏脸数据 编辑:程序博客网 时间:2024/06/08 06:26
今天在drop一张表的时候报ORA-00054错误

SQL> drop table t2;
drop table t2
           *
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

google之后,参考网上的高手,操作如下:

1.用dba权限的用户查看数据库都有哪些锁

SQL> select t2.username,t2.sid,t2.serial#,t2.logon_time
  2  from v$locked_object t1,v$session t2
  3  where t1.session_id=t2.sid order by t2.logon_time;


USERNAME                              SID    SERIAL# LOGON_TIM
------------------------------ ---------- ---------- ---------
CLS                                     1          7 23-JUL-12
CLS                                     1          7 23-JUL-12

知道被锁的用户cls,sid为1,serial#为7

2.根据sid查看具体的sql语句,如果sql不重要,可以kill

SQL> select sql_text from v$session a,v$sqltext_with_newlines b
  2  where DECODE(a.sql_hash_value,0,prev_hash_value,sql_hash_value)=b.hash_value
  3  and a.sid=&sid order by piece;

Enter value for sid: 1
old   3: and a.sid=&sid order by piece
new   3: and a.sid=1 order by piece

SQL_TEXT
----------------------------------------------------------------
DELETE FROM PLAN_TABLE WHERE STATEMENT_ID=:1

3.kill该事务

SQL> alter system kill session '1,7';

System altered.

4.这样就可以执行其他的事务sql语句了

SQL> drop table t2;

Table dropped.


From:http://space.itpub.net/12778571/viewspace-561543




原创粉丝点击