如何从 Oracle 表中删除表分区?
我发现特定表上使用的分区会损害查询性能,并且希望从表中删除这些分区。有没有简单的方法可以做到这一点?该表有 64 个分区。根据一些初步调查,我提出了以下选项。有更好的办法吗?
- 将数据复制到另一个表,删除所有分区,然后将数据复制回原始表
- 将数据复制到另一个表,删除原始表,然后重命名新表并重建索引
- 使用 MERGE PARTITION 将所有分区合并为一个分区
想法?
I've discovered that the partitions used on a particular table are hurting query performance and would like to remove the partitions from the table. Is there an easy way to do this? The table in question has 64 partitions. Based on some initial investigation, I've come up with the following options. Is there a better way?
- Copy data into another table, drop all partitions, then copy the data back into the original table
- Copy data into another table, drop the original table, then rename the new table and rebuild the indexes
- Use MERGE PARTITION to merge all partitions into a single partition
Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我个人认为选项 2 的变体听起来是最好的方法。
旧表
不同
旧表到新表。还要传输任何授权、同义词等。
(*)非分区表可能需要与分区表不同的索引。如果您特别重视索引名称,则可以在步骤 6 之后使用 ALTER INDEX ... RENAME TO ... 语法。
这种方法的优点是可以最大限度地减少停机时间(基本上是步骤 3、 4 和 5)。
Personally I think a variant on option 2 sounds like the best approach.
old table
different
old table to new table. Also transfer any grants, synonyms, etc.
(*) A non-partitioned table will probably require different indexes from the partitioned one. If you are particularly attached to the index names you can use
ALTER INDEX ... RENAME TO ...
syntax after step 6.The advantage of this approach is that it minimises your downtime (basically steps 3, 4 and 5).
对表进行分区可能会损害查询性能,但也可以提高性能......
这取决于您的技术解决方案的设计,使用正确的索引、提示等...
如果您想在不停机的情况下从表中删除分区并使正在使用您的表的其他对象失效,您可以使用
dbms_redefinition
它将在您配置/计划重新定义过程时分析和移动索引,您可以配置表的结构。这将从表中移动数据,而不会使其他对象失效,并且不需要任何停机时间。
Partitioning the table, can hurt query performance, but also it can improve performance...
It depends on design of your technical solution, using correct indexes, hints and etc...
If you want to remove partitions from your table without downtime and invalidating other objects which are using your table, you can use
dbms_redefinition
which will analyse and move indexes as you configure/plan your redefinition process, you can configure your table's structure.This will move your data from tables without invalidating other objects and there is no need for any downtime.