删除表空间时报ORA-00959: 表空间不存在,但在dba_tablespaces中的确能查询到这个表空间。
SQL> DROP TABLESPACE LIANG INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE LIANG INCLUDING CONTENTS AND DATAFILES
ORA-00959: 表空间 'LIANG' 不存在
SQL> SELECT tablespace_name FROM dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
Liang
。。。。。。
以为是大小写的原因,试了一下跟表空间中一致的表空间名一样也删不掉。
SQL> DROP TABLESPACE Liang INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE Liang INCLUDING CONTENTS AND DATAFILES
ORA-00959: 表空间 'LIANG' 不存在
在数据库的alert_sid.log中找到创建表空间的脚本如下:
Fri Mar 04 09:02:19 2011
CREATE tablespace "Liang" DATAFILE 'D:/ORACLE/TEST01.DBF' SIZE 10M
Completed: CREATE tablespace "Liang" DATAFILE 'D:/ORACLE/TEST01.DBF' SIZE 10M
-- 原来在创建表空间时,对表空间名加了引号。难怪删不掉呢。
删除时的错误
Fri Mar 18 09:04:28 2011
DROP TABLESPACE Liang INCLUDING CONTENTS AND DATAFILES
ORA-959 signalled during: DROP TABLESPACE Liang INCLUDING CONTENTS AND DATAFILES
--创建时加双引号,删除也加入双引号即可
SQL> DROP TABLESPACE "Liang" INCLUDING CONTENTS AND DATAFILES;
Tablespace dropped
Deleted file D:/ORACLE/TEST01.DBF
Completed: DROP TABLESPACE "Liang" INCLUDING CONTENTS AND DATAFILES
经常遇到oracle中有对象不能删除的情况,大多数都与创建对象时对象名中加了双引号有关系。
对数据库的操作,规范非常重要!!!