Oracle 中的表压缩要求
我有一个总大小为 600 MB 的表空间(这是我的测试机),可用空间为 110 MB。我试图压缩一个大小为 120 MB 的表。执行命令时:
alter table DOWNLOADSESSIONLOG move compress;
我收到错误消息:
(错误):ORA-01659:无法在表空间 WAP 中分配超过 16 的 MINEXTENTS。
我正在搜索,所有人都在说增加表空间,但我想知道我需要提供多少空间,因为我不想提供一些 200 /300 MB 的额外空间。我想在我的测试机中对此进行测试,并希望在具有 60 GB 表空间和一个 47 GB 表的实时系统上实现。我想在实时系统上压缩 47 GB 表,在此之前我想在测试环境中测试它。有没有计算过我们需要给多少空间?否则,在实时系统上,我需要提供大量不必要的空间,这很困难。
感谢有人可以提供一些想法。
I have a Tablespace with total Size 600 MB(this is my test machine), and free space of 110 MB. I was trying to compress a table that's size is 120 MB. When execute the commands:
alter table DOWNLOADSESSIONLOG move compress;
I'm getting error saying:
(Error): ORA-01659: unable to allocate MINEXTENTS beyond 16 in tablespace WAP.
I was searching and all are saying to increase the Tablespace, but I wanted to know how much space I need to give, because I don't want to gave some 200 /300 MB extra space. I wanted to test this in my Test Machine and wanted to implement on Live system that have 60 GB tablespace with one 47 GB table. I wanted to compress 47 GB table on live system, before that I wanted to test it in test environment. Is there any calculation how much space we need to give; otherwise on live system I need to give Lots of space unnecessarily and its difficult.
Appreciate somebody can give some ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将在测试环境中创建一个新的一次性表空间,该表空间与生产环境中的目标表空间具有相同的特征,然后将表移动/压缩到其中。这将为您提供需要多少额外空间的最佳估计。获得此编号后,您可以将表移回原始表空间并删除新表空间。
请记住,在移动期间,表空间中至少需要(原始大小)+(压缩大小)可用。
I would create a new throw-away tablespace in your test environment that has the same characteristics as your target tablespace in the production environment and then move/compress your table into that. This will give you the best estimate of how much additional space will be necessary. You can move the table back to the original tablespace and drop the new tablespace once you have this number.
Remember that you'll need at least (original size) + (compressed size) available in the tablespace for the duration of the move.
压缩的关键在于它的工作原理是删除每个块中的重复值。因此,您的测试表需要具有代表性的数据分布。
两个极端的表...
在压缩之前,让我们检查表大小...
如果我们压缩它们,我们会得到两个完全不同的结果...
请注意,TOTALLY_SIMILAR 有八个块大,即使每一行都是相同的。因此,您需要先了解数据的分布,然后才能计算压缩率。 Oracle 文档 是这样说的:
在估计回报时,它的建议是目标表的 1000 个块的样本表应该为您提供足够好的预测(尽管更多块可以提供更准确的预测)。在不知道你的块大小的情况下很难判断,但你的 TEST 表似乎比它需要的大得多。重要的是测试表中的数据是否能代表您的目标表。那么,您是使用导出还是目标表中的样本来创建它,例如,
您将需要调整 SAMPLE() 子句中的百分比以确保获得至少 1000 个块。
编辑
在大多数情况下,压缩实际上应该加快数据检索速度,但 YMMV 除外。插入或更新数据时会产生压缩成本。税费是多少以及您是否可以采取任何措施来避免税费取决于您的餐桌的情况。
The key thing about compression is that it works by removing duplicate values in each block. So your test table needs to have a representative spread of data.
Two extreme tables ...
Before we compress let's just check the table sizes...
If we compress them we get two radically different results ...
Note that TOTALLY_SIMILAR is eight blocks big, even though every single row was the same. So you need to understand the distribution of your data before you can calculate the compression ratio. The Oracle documentation has this to say:
Its advice when it comes to estimation of the return is that a sample table of 1000 blocks of the target table should give you a good enough prediction (although more blocks give a more accurate forecast). It is hard to tell without knowing your blocksize, but it seems likely that your TEST table is much bigger than it needs to be. The important thing is whether the data in the test table is representative of your target table. So, did you create it using an export or a sample from the target table, e.g.
You will need to adjust the percentage in the SAMPLE() clause to ensure you get at least 1000 blocks.
edit
In most cases compression should actually speed up data retrieval but YMMV. The cost of compression is paid when inserting or updating the data. How much that tax is and whether you can do anything to avoid it rather depends on the profile of your table.