+ -
当前位置:首页 → 问答吧 → 关于UNDO_RETENTION 参数

关于UNDO_RETENTION 参数

时间:2008-01-11

来源:互联网

Committed undo information normally is lost when its undo space is overwritten by a newer transaction. But for consistent read purposes, long running queries might require old undo information for undoing changes and producing older images of data blocks. The initialization parameter, UNDO_RETENTION, provides a means of explicitly specifying the amount of undo information to retain. With a proper setting, long running queries can complete without risk of receiving the "snapshot too old" error.
官方文档的描述,这个参数的意思是不是控制undo保留时间,如果过了这个时间,就不再保留了。如果查询的时间太长,会有可能导致出现"snapshot too old"错误

[ 本帖最后由 foxmile 于 2008-1-11 17:04 编辑 ]

作者: foxmile   发布时间: 2008-01-11

没超过这个值的话,如果没空间且无法扩展,也会覆盖。

作者: alantany   发布时间: 2008-01-11

如果过了这个时间,可以覆盖,保留不保留不好说

作者: lijiebin   发布时间: 2008-01-11

应该是的。

作者: ilovemk   发布时间: 2008-01-11

你的意思是,应该是啥?

作者: lijiebin   发布时间: 2008-01-11



QUOTE:原帖由 alantany 于 2008-1-11 17:03 发表
没超过这个值的话,如果没空间且无法扩展,也会覆盖。

这个值是以秒为单位,那它和空间如何挂钩呢。

作者: foxmile   发布时间: 2008-01-11



QUOTE:原帖由 ilovemk 于 2008-1-11 17:04 发表
应该是的。

我觉得应该是这个意思,但是时间和空间是怎么联系起来的

作者: foxmile   发布时间: 2008-01-11

这个参数的意思是
如果产生的undo超过这个时间,数据库就不管了,有可能被复用
snapshoot too old,这个错误是很经典的

作者: lijiebin   发布时间: 2008-01-11



QUOTE:原帖由 lijiebin 于 2008-1-11 17:07 发表
这个参数的意思是
如果产生的undo超过这个时间,数据库就不管了,有可能被复用
snapshoot too old,这个错误是很经典的

这个错误我了解。

alan的版主的意思是不是说,通过空间和时间一起来控制undo的保留情况

作者: foxmile   发布时间: 2008-01-11

差不多理解了。以前没注意过这个参数

作者: foxmile   发布时间: 2008-01-11

我在想,是不是如果希望undo保留时间长,在增加UNDO_RETENTION参数的同时,得增加undo tablespace的大小。

作者: foxmile   发布时间: 2008-01-11

作者: lijiebin   发布时间: 2008-01-11



QUOTE:原帖由 lijiebin 于 2008-1-11 17:24 发表

多谢

作者: foxmile   发布时间: 2008-01-11

UNDO_RETENTION 的单位是s,是UNDO内数据保留的时间,超过这个时间UNDO的数据没commit或者rollback就会自动撤消,要是那时候需要rollback,就会报1555:snapshot too old 错误了!

作者: linjia828   发布时间: 2008-01-11

commit之后在undo中需要保留的时间,以秒为单位,主要是应对long query
如果query发生在修改之前,此时可能需要通过undo来构造一致性读取,如果读不到,就报ora-01555

作者: warehouse   发布时间: 2008-01-12



QUOTE:原帖由 warehouse 于 2008-1-12 08:56 发表
commit之后在undo中需要保留的时间,以秒为单位,主要是应对long query
如果query发生在修改之前,此时可能需要通过undo来构造一致性读取,如果读不到,就报ora-01555

这个是正解

作者: zhefeng   发布时间: 2008-01-12



QUOTE:原帖由 warehouse 于 2008-1-12 08:56 发表
commit之后在undo中需要保留的时间,以秒为单位,主要是应对long query
如果query发生在修改之前,此时可能需要通过undo来构造一致性读取,如果读不到,就报ora-01555

理解。呵呵,多谢版主

作者: foxmile   发布时间: 2008-01-12

空间是自动控制的!一般是900秒!建议一般使用1800秒!

作者: sylvanzzy   发布时间: 2008-01-12

如果时间不够!数据库会报快照过旧的错误!

作者: sylvanzzy   发布时间: 2008-01-12

可以理解为,这个值是commit之后,undo信息保留时间的一个参考值。
如果undo表空间的大小不够,就可能还没达到这个值undo信息就会被覆盖;
如果undo表空间的大小足够,就算超过了这个值undo信息也未必会被覆盖。

[ 本帖最后由 ilonng 于 2008-1-12 15:36 编辑 ]

作者: ilonng   发布时间: 2008-01-12

多谢大家关注。讨论的很透彻。

作者: foxmile   发布时间: 2008-01-12

学习了

作者: sam_gyg   发布时间: 2008-01-13



QUOTE:原帖由 warehouse 于 2008-1-12 08:56 发表
commit之后在undo中需要保留的时间,以秒为单位,主要是应对long query
如果query发生在修改之前,此时可能需要通过undo来构造一致性读取,如果读不到,就报ora-01555

还是warehouse讲的好,不愧是讲师

作者: linjia828   发布时间: 2008-01-13

学习学习了

作者: ward   发布时间: 2008-01-13



QUOTE:原帖由 foxmile 于 2008-1-12 15:35 发表
多谢大家关注。讨论的很透彻。

请问一下,为何commit之后,还要在undo中保留?

作者: hdydmichael   发布时间: 2008-07-16

Oracle uses the undo blocks within a undo segment in a circular fashion.
If oracle run out of undo blocks in a specific extent, it will move to the next extent.
At this time,
(1) If the next extent has an active transaction, them Oracle will not move to this extent (Oracle will not skip over this extent because the circular fashion)
      a) extend the segment by adding a new extent if the undo tablespace is autoextend
      b)can not extend the segment, ORA-01562
(2)If there is no active transaction in the next extent
      a) if this extent committed less than undo_retention seconds
          - if there is enough space in the undo tablespace, Oracle will adding a new extent
          - if there is no space in the undo tablespace, Oracle will overwrite the committed undo blocks, so if some query
            is  using  this committed blocks to construct the consistent image, then ORA-01555
      b)if this extent committed more than undo_retention seconds
         - overwrite this extent

[ 本帖最后由 blue_or_white 于 2008-7-16 10:14 编辑 ]

作者: blue_or_white   发布时间: 2008-07-16



QUOTE:原帖由 ilonng 于 2008-1-12 15:28 发表
可以理解为,这个值是commit之后,undo信息保留时间的一个参考值。
如果undo表空间的大小不够,就可能还没达到这个值undo信息就会被覆盖;
如果undo表空间的大小足够,就算超过了这个值undo信息也未必会被覆盖。

假定undo空间足够大,如果被覆盖的话,是否和slot被覆盖有关?

[ 本帖最后由 venee_lee 于 2009-4-15 14:07 编辑 ]

作者: venee_lee   发布时间: 2009-04-15

不加guarantee 的话,undo_retention 不能保证什么的

作者: rohuddu   发布时间: 2009-04-15

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 AUTO

作者: chennanct   发布时间: 2011-09-08

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

作者: chennanct   发布时间: 2011-09-08