错误地删除了一些 Oracle DBF 文件 - 我如何告诉 Oracle XE 忘记它们?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2183752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Deleted some Oracle DBF files by mistake - how can I tell Oracle XE to forget about them?
提问by Ed .
So I accidentally deleted some DBF files (only ones specific to my tablespaces), fortunately I was only just about to start loading data in so have lost nothing, except now can't re-create the tablespaces.
所以我不小心删除了一些 DBF 文件(只有特定于我的表空间的文件),幸运的是我刚刚开始加载数据所以没有丢失任何东西,除了现在无法重新创建表空间。
If I run:
如果我运行:
select name from v$datafile;
The results include the DBF files that I deleted.
结果包括我删除的 DBF 文件。
I attempted to run a command I found on the internet, to delete the DBF files that Oracle thinks are relevant:
我试图运行我在互联网上找到的命令,删除 Oracle 认为相关的 DBF 文件:
alter database datafile '<A_DBF_file_that_no_longer_exists>' offline drop;
And the result is:
结果是:
alter database datafile succeeded
However the datafile deleted is still returned when I run the select statement. When I try to just create new tablespaces, I get the error:
但是,当我运行 select 语句时,仍会返回已删除的数据文件。当我尝试只创建新表空间时,出现错误:
SQL Error: ORA-01543: tablespace 'my_tablespace_name' already exists
01543. 00000 - "tablespace '%s' already exists"
*Cause: Tried to create a tablespace which already exists
*Action: Use a different name for the new tablespace
采纳答案by Erich Kitzmueller
Drop the affected tablespace, too. Droping the datafile will not automagically drop the tablespace.
也删除受影响的表空间。删除数据文件不会自动删除表空间。
DROP TABLESPACE mytablespace
INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
回答by Peter Lang
Try
尝试
DROP TABLESPACE <tablespace name> INCLUDING CONTENTS;
How to drop a datafile from a tablespacecould be interesting for more information:
如何从表空间中删除数据文件可能会很有趣以获取更多信息:
NOTE:The
ALTER DATABASE DATAFILE <datafile name> OFFLINE DROP
command, is not meant to allow you to remove a datafile. What the command really means is that you are offlining the datafile with the intention of dropping the tablespace.
注意:该
ALTER DATABASE DATAFILE <datafile name> OFFLINE DROP
命令并不意味着允许您删除数据文件。该命令的真正含义是为了删除表空间而使数据文件脱机。