红联Linux门户
Linux帮助

在Oracle数据库中一个datafile可以被drop的条件

发布时间:2015-03-10 09:44:45来源:linux网站作者:msdnchina

参考mos文章:
Unable to Drop a Datafile From the Tablespace Using Alter Tablespace Command (文档 ID 1050261.1)

违反下列任何一个条件,该datafile均不能被drop


1)必须为空,否则会报:ORA-03262: the file is non-empty。值得注意的是,non-empty的含义是有extent被分配给了table,而不是该table中有无rows
此时若是使用drop table xxx是不行的,必须使用 drop table xxx purge;
或者在已经使用了drop table xxx的情况下,再使用purge table “xxx表在回收站中的名称”来purge该表,否则空间还是不释放,datafile依然drop不掉。

2)不能是所属表空间的第一个file
以上两者可以通过drop tablespace来达到目的。

3)不能在read-only表空间中。
4)不能被offline,否则会报:ORA-03264: cannot drop offline datafile of locally managed tablespace


针对该报错,解决方法为:
[Oracle@rhel63single u02]$ oerr ora 3264
03264, 00000, "cannot drop offline datafile of locally managed tablespace"
// *Cause:  Trying to drop offline datafile in lmts
// *Action: Try to drop file afetr making it online
[oracle@rhel63single u02]$