UNDO_RETENTIOIN

我们先看看对于UNDO_RETENTIOIN的解释:

10G的解释:

The UNDO_RETENTION parameter is ignored for a fixed size undo tablespace. The database may overwrite unexpired undo information when tablespace space becomes low.
For an undo tablespace with the AUTOEXTEND option enabled, the database attempts to honor the minimum retention period specified by UNDO_RETENTION. When space is low, instead of overwriting unexpired undo information, the tablespace auto-extends. If the MAXSIZE clause is specified for an auto-extending undo tablespace, when the maximum size is reached, the database may begin to overwrite unexpired undo information.
UNDO_RETENTION参数对于固定大小的undo表空间是被忽略的。当undo表空间不足时,oracle会重写未过期的undo区。对于能够自动扩展的undo表空间,数据库尽量保证UNDO_RETENTION参数设置的undo空间保留的最小时间。当undo空间不足时,数据库会去自动扩展undo表空间的大小,而不是去重写未过期的undo空间。对于自动扩展的undo表空间的配额达到了MAXSIZE指定的最大值时,数据库就会去重写未过期的undo空间。

11G的解释:

UNDO_RETENTION specifies (in seconds) the low threshold value of undo retention. For AUTOEXTEND undo tablespaces, the system retains undo for at least the time specified in this parameter, and automatically tunes the undo retention period to satisfy the undo requirements of the queries. For fixed- size undo tablespaces, the system automatically tunes for the maximum possible undo retention period, based on undo tablespace size and usage history, and ignores UNDO_RETENTION unless retention guarantee is enabled.

The UNDO_RETENTION parameter can only be honored if the current undo tablespace has enough space. If an active transaction requires undo space and the undo tablespace does not have available space, then the system starts reusing unexpired undo space. This action can potentially cause some queries to fail with a "snapshot too old" message.

UNDO_RETENTION参数指定了undo空间保留时间的最低阈值。对于自动扩展的undo表空间,系统至少会保存这个参数指定的undo空间,会自动调整undo的保存时间来满足一些对undo有要求的查询。对于固定大小的undo表空间,会忽略UNDO_RETENTION参数的设置,系统会根据undo表空间的大小和使用的历史情况,去自动调整到undo保存的最大时间,除非 undo表空间设置了retention guarantee。

只有当undo表空间有足够的空间时,UNDO_RETENTION指定的undo保留时间才能被保证。如果一个正在执行的事务需要undo空间,但是undo表空间又没有这么大的可用空间时,系统就会重用未过期的undo空间。这样的操作就可能会引起查询出现快照过旧的问题。


通过上面10G,11G对UNDO_RETENTION的解释,我们可以解释一些现象:

1. 为什么DBA_UNDO_EXTENTS里老是有那么多EXPIRED的区不回收?--因为oracle在空间足够的情况下,只保证UNDO_RETENTIOIN参数指定的最小保留时间,至于最长保留多久就是它自己管理的,我们管不着。

2. 如果保证undo的保留时间?alter tablespace UNDOTBS1 retention guarantee;alter tablespace UNDOTBS1 retention noguarantee;

3. undo空间的使用顺序是什么?

   如果空间足够的情况下(包括能够自动扩展):使用多余的空间(包括过期的undo空间);

   如果过期的undo空间也用完,则看undo表空间guarantee的设置(看dba_tablespace),如果有保障,则不会用未过期的undo空间(操作很可能就会失败),如果没有保障则使用未过期的undo空间

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值