在AUM模式下,我们知道UNDO_RETENTION参数用以控制事务提交以后undo信息保留的时间。该参数以秒为单位,9iR1初始值为900秒,在Oracle9iR2增加为10800秒。但是这是一个NO Guaranteed的限制。
也就是说,如果有其他事务需要回滚空间,而空间出现不足时,这些信息仍然会被覆盖。
很多时候这是不希望看到的。
从Oracle10g开始,如果你设置UNDO_RETENTION为0,那么Oracle启用自动调整以满足最长运行查询的需要。当然如果空间不足,那么Oracle满足最大允许的长时间查询。而不再需要用户手工调整。
同时Oracle增加了Guarantee控制,也就是说,你可以指定UNDO表空间必须满足UNDO_RETENTION的限制。
SQL> alter tablespace undotbs1 retention guarantee;
Tablespace altered
SQL> alter tablespace undotbs1 retention noguarantee;
Tablespace altered
在DBA_TABLESPACES视图中增加了RETENTION字段用以描述该选项:
SQL> select tablespace_name,contents,retention from dba_tablespaces;
TABLESPACE_NAME CONTENTS RETENTION
------------------------------ --------- -----------
SYSTEM PERMANENT NOT APPLY
UNDOTBS1 UNDO NOGUARANTEE
SYSAUX PERMANENT NOT APPLY
TEMP TEMPORARY NOT APPLY
USERS PERMANENT NOT APPLY
EYGLE PERMANENT NOT APPLY
TEST PERMANENT NOT APPLY
ITPUB PERMANENT NOT APPLY
TRANS PERMANENT NOT APPLY
BIGTBS PERMANENT NOT APPLY
TEMP2 TEMPORARY NOT APPLY
TEMP03 TEMPORARY NOT APPLY
DFMBRC PERMANENT NOT APPLY
T2K PERMANENT NOT APPLY
14 rows selected
在Oracle官方文档上这样解释:
RETENTION Undo tablespace retention:
GUARANTEE - Tablespace is an undo tablespace with RETENTION specified as GUARANTEE
A RETENTION value of GUARANTEE indicates that unexpired undo in all undo segments in the undo tablespace should be retained even if it means that forward going operations that need to generate undo in those segments fail.
NOGUARANTEE - Tablespace is an undo tablespace with RETENTION specified as NOGUARANTEE
NOT APPLY - Tablespace is not an undo tablespace.
查看本文来源