是否建议在 Oracle 表空间中使用统一的扩展区大小?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/921136/
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
Is it recommended practice to use uniform extent sizes in Oracle tablespaces?
提问by RC.
I've been using Oracle for quite some time since Oracle 8i was released. I was new to the database at that time and was taught that it was best to use constant sized extent sizes when defining tablespaces.
自从 Oracle 8i 发布以来,我一直在使用 Oracle。当时我是数据库的新手,并被教导在定义表空间时最好使用固定大小的范围大小。
From what I have read, it seems that today using 10/11g, that Oracle can manage these extent sizes for you automatically and that it may not keep extent sizes constant. I can easily see how this can more efficiently use disk space, but are their downsides to this. I'm thinking it may be time to let go of the past on this one. (assuming my past teaching was correct in the first place)
从我读到的内容来看,似乎今天使用 10/11g,Oracle 可以自动为您管理这些范围大小,并且它可能无法保持范围大小不变。我可以很容易地看到这如何更有效地使用磁盘空间,但这是它们的缺点。我想是时候在这个问题上放下过去了。(假设我过去的教学一开始是正确的)
回答by dpbradley
Yes, except for very unusual cases it's time to let go of the past and use the new Oracle extent management features. Use locally-managed tablespaces (LMT's) and the auto extent sizing and you don't have to think about this stuff again.
是的,除了非常不寻常的情况,是时候放弃过去并使用新的 Oracle 盘区管理特性了。使用本地管理的表空间 (LMT) 和自动扩展区大小调整,您就不必再考虑这些问题了。
As a DBA, the variable extent sizing worried me at first since in the 7.3 days I spent a lot of time reorganizing tablespaces to eliminate the fragmentation that resulted from extent allocation with non-zero percent increases. (and you needed non-zero percent increases because your maximum number of extents was capped at different levels depending on the database block size used when you created the database) However, Oracle uses an algorithm to determine the rate and magnititude of extent size increases that effectively eliminates fragmentation.
作为一名 DBA,可变盘区大小一开始让我担心,因为在 7.3 天里,我花了很多时间重新组织表空间以消除因盘区分配增加非零而导致的碎片。(并且您需要非零百分比的增加,因为根据创建数据库时使用的数据库块大小,您的最大范围数被限制在不同级别)但是,Oracle 使用一种算法来确定范围大小增加的速率和幅度有效消除碎片。
Also, forget anything you have heard about how the optimum configuration is to have a table or index fit into a single extent or that you can somehow manage i/o through extent configuration - this has never been true. In the days of dictionary-managed tablespace there was probably some penalty to having thousands of extents managed in a dictionary table, but LMT's use bitmaps and this is not an issue. Oracle buffers blocks, not segment extents.
此外,忘记任何您听说过的关于最佳配置如何将表或索引放入单个范围的内容,或者您可以通过范围配置以某种方式管理 i/o - 这从来都不是真的。在字典管理表空间的时代,在字典表中管理数千个范围可能会受到一些惩罚,但 LMT 使用位图,这不是问题。Oracle 缓冲块,而不是段范围。
回答by Quassnoi
If you have unlimited disk space with instant access time, you don't have to care about extents at all.
如果您有无限的磁盘空间和即时访问时间,您根本不必关心范围。
You just make every table INITIAL 100T NEXT 100T MAXEXTENTS UNLIMITED PCTINCREASE 0
and forget about extents for next 300
years.
您只需制作每张表INITIAL 100T NEXT 100T MAXEXTENTS UNLIMITED PCTINCREASE 0
而忘记明年的范围300
。
The problems arise when your disk space is not unlimited oraccess time varies.
当您的磁盘空间不是无限的或访问时间不同时,就会出现问题。
Extents are intended to cope with data sparseness: when your data are fragmented, you will have your HDD
head to jump from one place to another, which takes time.
Extents 旨在应对数据稀疏性:当您的数据碎片化时,您将不得不HDD
从一个地方跳到另一个地方,这需要时间。
The ideal situation is having all your data for each table to reside in one extent, while having data for the table you join most often to reside in the next extent, so everything can be read sequentially.
理想的情况是将每个表的所有数据都驻留在一个范围内,而将最常连接的表的数据驻留在下一个范围内,这样所有内容都可以按顺序读取。
Note that access time also includes access time needed to figure out where you data resides. If your data are extremely sparse, extra lookups into the extent dictionaries are required.
请注意,访问时间还包括确定数据所在位置所需的访问时间。如果您的数据非常稀疏,则需要额外查找范围字典。
Nowadays, disk space is not what matters, while access time still matters.
如今,磁盘空间并不重要,而访问时间仍然很重要。
That's why Oracle
created extent management.
这就是Oracle
创建范围管理的原因。
This is less efficient in term of space used than hand-crafted extent layout, but more efficient in terms of access time.
与手工制作的范围布局相比,这在空间使用方面效率较低,但在访问时间方面效率更高。
So if your have enough disk space (i. e. your database will take less than half of the disk for 5
years), then just use automatic extents.
因此,如果您有足够的磁盘空间(即您的数据库5
多年来占用的磁盘空间不到磁盘的一半),那么只需使用自动扩展。