UndoSegment in-depth analysis

Source: Internet
Author: User
During automatic undo management, after undo_retention is set, the undo block has four statuses. Active: indicates that the transaction using this undo has not been committed or rolled back. Inac

During automatic undo management, after undo_retention is set, the undo block has four statuses. Active: indicates that the transaction using this undo has not been committed or rolled back. Inac

During automatic undo management, after undo_retention is set, the undo block has four statuses.

Active: indicates that the transaction using this undo has not been committed or rolled back.
Inactive: indicates that there are no active transactions on the undo, And the undo in this status can be overwritten by other transactions.
Expired: indicates that the duration of the undo continuous inactive operation exceeds the time specified by undo_retention.
Freed: indicates that the content of the undo block is empty and never used.

Undo Retention

After a transaction is committed, undo data is no longer needed for rollback or transaction recovery purposes. however, for consistent read purposes, long-running queries may require this old undo information for producing older images of data blocks. furthermore, the success of several Oracle Flashback features can also depend upon the availability of older undo information. for these reasons, it is desirable to retain the old undo information for as long as possible.

When automatic undo management is enabled, there is always a current undo retention period, which is the minimum amount of time that Oracle Database attempts to retain old undo information before overwriting it. old (committed) undo information that is older than the current undo retention period is said to be expired. old undo information with an age that is less than the current undo retention period is said to be unexpired.

Oracle Database automatically tunes the undo retention period based on undo tablespace size and system activity. you can specify a minimum undo retention period (in seconds) by setting the UNDO_RETENTION initialization parameter. the database makes its best effort to honor the specified minimum undo retention period, provided that the undo tablespace has space available for new transactions. when available space for new transactions becomes short, the database begins to overwrite expired undo. if the undo tablespace has no space for new transactions after all expired undo is overwritten, the database may begin in overwriting unexpired undo information. if any of this overwritten undo information is required for consistent read in a current long-running query, the query cocould fail with the snapshot too old error message.

The following points explain the exact impact of the UNDO_RETENTION parameter on undo retention:

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.

Automatic Tuning of Undo Retention

Oracle Database automatically tunes the undo retention period based on how the undo tablespace is configured.

If the undo tablespace is fixed size, the database tunes the retention period for the best possible undo retention for that tablespace size and the current system load. this tuned retention period can be significantly greater than the specified minimum retention period.

If the undo tablespace is configured with the AUTOEXTEND option, the database tunes the undo retention period to be somewhat longer than the longest-running query on the system at that time. again, this tuned retention period can be greater than the specified minimum retention period.

Note:

Automatic tuning of undo retention is not supported for LOBs. this is because undo information for LOBs is stored in the segment itself and not in the undo tablespace. for LOBs, the database attempts to honor the minimum undo retention period specified by UNDO_RETENTION. however, if space becomes low, unexpired LOB undo information may be overwritten.

You can determine the current retention period by querying the TUNED_UNDORETENTION column of the V $ UNDOSTAT view. this view contains one row for each 10-minute statistics collection interval over the last 4 days. (Beyond 4 days, the data is available in the DBA_HIST_UNDOSTAT view .) TUNED_UNDORETENTION is given in seconds.

Select to_char (begin_time, 'dd-MON-RR HH24: MI ') begin_time,

To_char (end_time, 'dd-MON-RR HH24: MI ') end_time, tuned_undoretention

From v $ undostat order by end_time;

BEGIN_TIME END_TIME TUNED_UNDORETENTION

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

04-FEB-05 04-FEB-05 12100

...

07-FEB-05 21 07-FEB-05 86700

07-FEB-05 07-FEB-05 86700

07-FEB-05 07-FEB-05 86700

07-FEB-05 07-FEB-05 86700

576 rows selected.

Undo tablespace loss caused by rman backup and recovery

About Oracle releasing over-used undo tablespace

Oracle undo

Oracle undo image data exploration

Oracle ROLLBACK and undo)

UNDO block allocation algorithm in automatic rollback segment Management Mode:

1. If the current extent has idle data blocks, use the current extent

2. If the next extent of the current extent is in the expired (expired) state, wrap (wrap) to an extent and use the first data block of the extent.

3. If the next extent does not have expired, the space is allocated from the undo tablespace. If there is space left, use the first data block of the newly allocated extent. The usage of undo tablespace increases.

4. If there is no idle extent, steal the expired extent from the rollback segment in the offline state, add the current rollback segment, and use the first data block.

5. If the offline status rollback segment does not contain the expired extent, steal (steal) Expiration zone from the online status rollback segment and add it to the current rollback segment, use the first data block in extent.

6. If undo tablespace can be extended, expand undo tablespace, add the new extent to the current rollback segment, and use the first data block, in this case, the operating system space occupied by undo is increased.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.