错误地删除了一些 Oracle DBF 文件 - 如何告诉 Oracle XE 忘记它们?

发布于 2024-08-20 11:29:18 字数 722 浏览 9 评论 0原文

因此,我不小心删除了一些 DBF 文件(仅特定于我的表空间的文件),幸运的是,我正要开始加载数据,所以没有丢失任何内容,只是现在无法重新创建表空间。

如果我运行:

select name from v$datafile;

结果包括我删除的 DBF 文件。

我尝试运行在互联网上找到的命令,删除 Oracle 认为相关的 DBF 文件:

alter database datafile '<A_DBF_file_that_no_longer_exists>' offline drop;

结果是:

alter database datafile succeeded

但是,当我运行 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

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.

If I run:

select name from v$datafile;

The results include the DBF files that I deleted.

I attempted to run a command I found on the internet, to delete the DBF files that Oracle thinks are relevant:

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:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤蝉 2024-08-27 11:29:18

也删除受影响的表空间。删除数据文件不会自动删除表空间。

DROP TABLESPACE mytablespace 
   INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;

Drop the affected tablespace, too. Droping the datafile will not automagically drop the tablespace.

DROP TABLESPACE mytablespace 
   INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
世界和平 2024-08-27 11:29:18

尝试

DROP TABLESPACE <tablespace name> INCLUDING CONTENTS;

如何从表空间中删除数据文件可能会很有趣欲了解更多信息:

注意:ALTER DATABASE DATAFILE <数据文件名称> OFFLINE DROP 命令并不意味着允许您删除数据文件。该命令的真正含义是您要使数据文件脱机,目的是删除表空间。


Try

DROP TABLESPACE <tablespace name> INCLUDING CONTENTS;

How to drop a datafile from a tablespace could 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文