码迷,mamicode.com
首页 > 数据库 > 详细

Oracle诊断:drop table失败[转]

时间:2016-04-13 18:19:00      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

: From <http://blog.csdn.net/cyxlxp8411/article/details/7775113>

 

今天在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,sid1serial#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.

Oracle诊断:drop table失败[转]

标签:

原文地址:http://www.cnblogs.com/recognition/p/5388099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!