日期:2014-05-17  浏览次数:20845 次

如何删除数据文件?急!
因为表空间不足,我增加了一个数据文件,因为忘指定所属
的表空间,所以用alter database datafile '...../*.dbf' offline drop;
想删掉该文件,但是在数据字典里仍然存在,online_status的状态为:recover.
该如何删除呢。。谢谢!


------解决方案--------------------
简单的对datafile的offline drop会在v$datafile及v$recover_file中留下信息的,目的是为了恢复用。

这些信息只有在drop tablespace时才会被清除掉.
------解决方案--------------------
alter database datafile '......' offline drop;这个操作只是数据库在非归档时使数据文件脱机,但drop子句并不从数据库中删除数据文件,要删除数据文件,必须删除数据文件所在的的表空间。在删除表空间之前,数据文件仍旧保留在数据字典中,其状态为RECOVER或OFFLINE。
原文:
DROP
If the database is in NOARCHIVELOG mode, you must specify the DROP clause to take a datafile offline. However, the DROP clause does not remove the datafile from the database. To do that, you must drop the tablespace in which the datafile resides. Until you do so, the datafile remains in the data dictionary with the status RECOVER or OFFLINE. 

If the database is in ARCHIVELOG mode, Oracle ignores the DROP keyword.
------解决方案--------------------
你把数据库设置为归档模式再删除

超级管理员身份登陆数据库
sqlplus "/ as sysdba"
查看归档模式
archive log list
alter database achivelog;
alter database datafile '...../*.dbf' online drop; 

------解决方案--------------------
这个嘛,很难,因为你不能保证 oracle 还没有在此数据文件中写入数据。

只能和表空间一起 drop 掉。