ORACLE 变量之 UNDO_RETENTION

官网:

Property Description
Parameter type Integer
Default value 900
Modifiable ALTER SYSTEM
Range of values 0 to 231 - 1
Oracle RAC Oracle recommends that multiple instances have the same value.

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.  

大小固定的undo 表空间,系统会根据该表空间的大小和使用历史情况来自动调整最大的可能保留undo 期限,如果undo表空间的retention guarantee 无效,那么会忽略UNDO_RETENTION 变量;

关于undo表空间的retention  guarantee设置:

{

Changing Undo Data Retention: Examples The following statement changes the undo data retention for tablespace undots1 to normal undo data behavior:

ALTER TABLESPACE undots1
  RETENTION NOGUARANTEE;

The following statement changes the undo data retention for tablespace undots1 to behavior that preserves unexpired undo data:

ALTER TABLESPACE undots1
  RETENTION GUARANTEE;
}

The setting of this parameter should account for any flashback requirements of the system. Automatic tuning of undo retention is not supported for LOBs. The RETENTION value for LOB columns is set to the value of the UNDO_RETENTION parameter.

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.

The amount of time for which undo is retained for the Oracle Database for the current undo tablespace can be obtained by querying the TUNED_UNDORETENTIONcolumn of the V$UNDOSTAT dynamic performance view.

See Also:

  • Oracle Database SQL Language Reference for more information about creating undo tablespaces

  • Oracle Database Administrator's Guide for more information about managing undo data

OCP题库中考察此知识点的题:

一.In which situation may the UNDO_RETENTION parameter be ignored, even if it is set to a value?


A.when the data file of the undo tablespace is autoextensible
B.when there are more than one undo tablespaces available in the database
C.when the undo tablespace is of a fixed size and retention guarantee is not enabled
D.when the undo tablespace is autoextensible and retention guarantee is not enabled

The answer is C


二.View the Exhibit and examine the attributes of an undo tablespace.
In an OLTP system, the user SCOTT has started a query on a large table in the peak transactional
hour that performs bulk inserts. The query runs for more than 15 minutes and then SCOTT receives the following error:

ORA-01555: snapshot too old

What could be the reason for this error?

A.The query is unable to get a read-consistent image.
B.There is not enough space in Flash Recovery Area.
C.There is not enough free space in the flashback archive.
D.The query is unable to place data blocks in undo tablespace.

因为undo_retention 默认是15分钟,所以到15分钟后才会出现此错误;

The answer is A    (不能得到一致性读)

你可能感兴趣的:(日常管理)