您的位置:首页 > 其它

关于 数据文件自增长 的一点理解

2010-09-30 09:51 309 查看
同事问了我数据文件自增长的问题。

我对表空间数据文件的处理原则是:

(1) 数据文件设置为自增长,每次自增长的大小为100M。最大值32G。 因为8k的数据块最大支持32G。

(2) 用脚本监控表空间使用率,超过90%时,手动的添加数据文件。 因为现在的文件系统比以前的好,可以将单个数据文件设置成10G,20G。 都没有什么问题。

同事问我,为什么不使用自增长,这个问题我也给不出一个十分有说服力的解释。 我把数据文件设成自增长是为了防止因为数据文件暴涨,导致表空间不足的问题。 至于手动添加数据文件,我的理解是多个数据文件比单个数据文件好,至少在出现坏块的时候,可以减少数据丢失的可能性,而且如果把数据文件放在不同的位置,还可以提高I/O的性能。 和 DBA1群的 西安-布豆 讨论了一下这个问题,他说Oracle 的专家也是使用手动添加数据文件的。

手动添加数据文件,增加了数据文件管理上的透明度,我们可以知道文件添加成功与否,而自动扩展的话,可能会出现因磁盘空间不足而导致的扩展失败。

还有一点就是I/O的影响。 我的理解: 如果每次都自增100M,在磁盘分配的空间不一定是连续的。 这样磁盘比较分散,每次读数据的时候,I/O的时间比较长,如果一次给10G,这样磁盘上空间是连续的,这样I/O会块一点。 在备份的时候,速度也会快一点。 西安-布豆 说这个是系统上应该考虑的问题。

个人对这块的理解也不是很透彻, 所以又google了一下。

这是itpub 论坛上,关于数据文件自增长的一些讨论,也没有一个统一的说法。

http://www.itpub.net/thread-1281633-1-1.html

数据文件自增长的好处是很明显的,不用DBA过多的关注表空间的问题。 但是我觉得监控表空间是DBA日常职责之一,如果使用自增长的话,可能会在思想上出现麻痹,过度依赖数据文件的自增长。反而不利于数据库的管理。

官网的一些说法:

You can create datafiles or alter existing datafiles so that they automatically increase in size when more space is needed in the database. The file size increases in specified increments up to a specified maximum.

Setting your datafiles to extend automatically provides these advantages:

· Reduces the need for immediate intervention when a tablespace runs out of space

· Ensures applications will not halt or be suspended because of failures to allocate extents

http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dfiles003.htm

Autoextend Tablespace

You can set a tablespace to automatically extend itself by a specified amount when it reaches its size limit. If you do not enable autoextend, you are alerted when the tablespace reaches its critical or warning threshold size. The critical and warning threshold parameters have default values that you can change at any time. These parameters also cause alerts to be generated for autoextending tablespaces that are approaching their specified size limit. You can respond to size alerts by manually increasing the tablespace size. You do so by increasing the size of one or more of the tablespace datafiles or by adding another datafile to the tablespace.

http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/storage001.htm#ADMQS12057

------------------------------------------------------------------------------

Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1 群:62697716(满); DBA2 群:62697977(满)

DBA3 群:63306533; 聊天 群:40132017

--加群需要在备注说明SGA的组成部分,否则拒绝申请
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: