Oracle诊断:drop table失败[转]

转: 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,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.

时间: 2024-11-09 02:17:57

Oracle诊断:drop table失败[转]的相关文章

oracle 11g drop table 后闪回

--初始化数据 drop table test purge; create table test as select * from dba_objects; delete from test where object_id is null; alter table test add constraint pk_test_object_id primary key(object_id); create index ind_t_object_name on test(object_name); --

ORACLE中Drop table cascade constraints

出处:https://www.cnblogs.com/xd502djj/archive/2010/11/16/1878392.html 当你要drop一个table时,如果删除table的动作会造成trigger或constraint产生矛盾,系统会出现错误警告的讯息而不会允许执行..一个极简单的例子,例如你有一个员工基本资料表,上面可能有员工编号和员工姓名等字段,另外有一个员工销售表,上面有员工编号和员工销售额两个字段,员工薪资表的员工编号字段为一个foreign key参照到员工基本资料表的

Oracle Flashback(flashback table或drop)

在Oracle 10g中,Flash back家族分为以下成员:Flashback DatabaseFlashback DropFlashback TableFlashback Query(分Flashback Query,Flashback Version Query,Flashback Transaction Query)下面介绍一下Flashback Drop 和Flashback Table 一 Flashback设置 1.打开flashback: 关闭数据库 启动到mount方式 SQ

Oracle Drop Table

DROP TABLE 使用DROP TABLE语句将表或对象表移动到回收站或从数据库中完全删除表及其所有数据. 注:除非指定purge子句,否则drop table语句不会将表占用的空间释放回表空间供其他对象使用,占用空间继续计入用户的空间配额. 对于外部表,此语句只删除数据库中的表元数据.它不会影响实际数据,实际数据位于数据库之外. 删除属于群集的表时,该表将移动到回收站.但是,如果随后除去集群,那么表将从回收站清空,不能再使用FLASHBACK TABLE进行恢复操作. 删除表将使依赖对象失

Oracle Flashback Drop: Undo a DROP TABLE Operation

7.4 Oracle Flashback Drop: Undoa DROP TABLE Operation Oracle Flashback Drop reverses theeffects of a DROP TABLE operation. It can be used to recover afterthe accidental drop of a table. Flashback Drop is substantially faster thanother recovery mechan

Oracle tips:drop table和purge

在操作Oracle时,我们经常都会删除一个表,当删除错误后,我们希望能够恢复该表,有时也希望删除表之后能够立刻释放表的空间.下面将介绍在Oracle中表的删除.恢复和空间释放. DROP TABLE 当你drop一个表时,数据库不会立刻释放表的空间,而是重命名这个表然后将其放入回收站中,可以通过下面的方式查看一个删除的表: select object_name,original_name from user_recyclebin where original_name = 'TEMP'; OBJ

Oracle drop table 和 truncate table对grant授权的影响

1.以sys登陆,建表赋予权限,准备测试表z2 [[email protected] ~]$ rlwrap sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue May 16 14:59:27 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition

oracle数据库中drop table与purge使用实例

oracle 数据库中 drop table 与purge 实际示例: CREATE OR REPLACE PROCEDURE pro_droptable IS cursor cur is select table_name from user_tables where table_name like 'TEMPTABLE%'; drop_sql     varchar2(1000); table_number number; BEGIN SELECT COUNT(*) INTO table_n

oracle drop table recyclebin恢复

1. 连接sqlplus 创建一个表 SQL> conn liang/chengce243 Connected. QL> create table T8 as select * from user_objects; Table created. SQL> select count(*) from T8; COUNT(*) ---------- 7 2.删除T8表 SQL> drop table T8; Table dropped. SQL> select count(*) f