oracle oracle大删除后回收空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9432465/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:59:00  来源:igfitidea点击:

reclaim the space after a large delete in oracle

oracle

提问by user1127214

In my application we are uploaded huge data.if any wrongly uploaded data then we can delete the data.So,whatever data deleted that space when will reclaim the data?.is there any impact on performance Is there anyway to reclaim the space after a large delete in oracle?.How to reclaim the space?

在我的应用程序中,我们上传了大量数据。如果有任何错误上传的数据,那么我们可以删除数据。那么,无论何时删除该空间的数据都会回收数据吗?是否对性能有任何影响?无论如何要回收空间oracle中的大删除?。如何回收空间?

回答by Adam Hawkes

In Oracle, deleting data does not automatically reclaim disk space. The database will retain its storage until you do somethingadministrative to the tablespace. The expectation of this behavior is that if you needed the storage at one time, you will likely need it again and it would therefore be more efficient to simply keep the allocation.

在 Oracle 中,删除数据不会自动回收磁盘空间。直到你的数据库将保留其存储的东西管理的表空间。这种行为的预期是,如果您一次需要存储,您可能会再次需要它,因此简单地保留分配会更有效。

As far as performance impact, less data to process will generally make queries go faster. :)

就性能影响而言,要处理的数据越少通常会使查询速度更快。:)

To reclaim the space, you have a few choices. This article from ORACLE-BASEhas a pretty comprehensive look at this situation.

要回收空间,您有几个选择。这篇来自 ORACLE-BASE 的文章对这种情况进行了非常全面的研究。

Also, why would you insert data, then determine it is "bad" to then delete it? Wouldn't you be better off avoiding putting the data in from the beginning?

另外,为什么要插入数据,然后确定它是“坏的”然后删除它?从一开始就避免将数据放入不是更好吗?

回答by Ollie

You need to research the High Water Mark(HWM).

您需要研究高水位线(HWM)。

Basically it is the maximum number of blocks that has ever been used by a specific table, if you load a large volume of data them you may well increase the HWM, deleting those records does not then reduce the HWM.

基本上它是特定表曾经使用过的最大块数,如果你加载大量数据,你很可能会增加 HWM,删除这些记录不会减少 HWM。

Hereis a great article on how to adjust the HWM and if, once you understand it, you think it may be affecting your environment then use the tips included to reduce your HWM.

是一篇关于如何调整 HWM 的精彩文章,如果您在理解之后认为它可能会影响您的环境,那么请使用包含的技巧来减少您的 HWM。

Hope it helps...

希望能帮助到你...

回答by Eagle

I know it is an old question, but for future references:

我知道这是一个老问题,但供将来参考:

  • DELETE empty the table but space is already "locked" for future fillings
  • TRUNCATE TABLE do the trick (you need to disable all foreign keys referencing the table in order to work).
  • DELETE 清空表,但空间已经“锁定”以备将来填充
  • TRUNCATE TABLE 可以解决问题(您需要禁用所有引用该表的外键才能工作)。

回答by SNAG

There is no way to reclaim space after delete. but if after the delete the size of the remaining data is relatively small then create a new table with the data, drop the old table and rename the new table to the old name

删除后无法回收空间。但如果删除后剩余数据的大小相对较小,则使用数据创建新表,删除旧表并将新表重命名为旧名称