Summary of delay block cleanup, snapshot too old, read consistent

Source: Internet
Author: User

About delay block clearance, snapshot over the old, read a consistent summary, I hope that the three knowledge points in tandem to do a summary, no exhaustive to write each place, welcome to discuss together, if there are predecessors pointed out the wrong place is greatly appreciated.


blockcleanout does not mean to write a dirty block to disk, but simply refers to the db buffer in a block from dirty to clean, indicating that the data inside the block is clear, up-to-date, essentially updating the block header A flag bit in theITL (interested Transaction list) and block SCN.

What is Delayed block cleanout ?

Every time a transaction commits, the changed blocks of the transaction are cleanout, but clean out has 2 ways: fast commit cleanout and delayed blockcleanout.

1.fastcommit cleanout is a true cleanout, as fast commit cleanout, Oracle takes the system SCN as the transaction commit as COMMITSCN, Immediately update the SCN on the block on the ITL, Block SCN, and undo segment header of the transaction table (slot), the three are consistent.

        2.delayedblock cleanout The cleanout operation was postponed, For some reason just use commit SCN updated the segment of the undo Transaction header The Slot SCN on table, while block update , waiting for the next time you use this block, Then use the slot SCN on the Transaction table of the Undo segment Header (commit SCN same) to update the block SCN and ITL. (the next operation, such as Select,update,insert or delete, needs to be in After complete block cleanup)

Why do you want to do Delayed block cleanout it?

This is for performance reasons, we first see which blocks will do delayed block cleanout

Prerequisite: Oracle has a MODIFIEDBLOCK list structure (checkpoint queue mechanism?). ), used to record each transaction changed block, each transaction can record about 10%buffercache the modified block on this list.

When a transaction commits:


  • changed block below 10% oracle can be based on modified block list Navigate to those blocks and do fast commit cleanout
  • changed block over 10% Then do it out of the section delayed block cleanout
  • blocks that have been written to disk before commit because the transaction takes too long do Delayed block cleanout .

Here, it can be seen that there are two reasons for not immediately cleanout, but the essence is not immediately found in the DB buffer corresponding block, the former is more than 10%, not recorded in the list, the latter is already written to disk, if re-read back to the DB buffer again modified, There are too many IO that affect performance.

What is the relationship between a snapshot and an old one? ?

If another session has used this block (clean), or is occupying this block (dirty), it will record ITL (ITL, XID, Flag, UDA, SCN\FSC) on the block.

1. When a SELECT statement is issued, Oracle logs the SCNat this point, then finds the required block in the buffer cache, or reads from disk.

   2. First to view most recent flag of the transaction that modifies this block, executed immediately if necessary cleanout. If the execution succeeds or does not require execution then compare the ITLSCN and select SCN, if the ITL SCN > select SCN, the proof block version is newer than the Select, to Perform read consistent to find the old version.

   3.oracle will find the Undo information based on the UBA in the ITL to obtain the front image of the block, and then construct the CR block in Buffercache, At this point Oralce will also check the structure of the CR block in the ITL record of the SCN, if the SCN is also greater than the SCN of the select time, then repeated construction of the pre-image, until the need to find the block, so that Oracle implemented a multi-version. However, if the undo information required in the process of pre-construction mirroring is overwritten, the is reported. So simply, is to use a recursive way to find and their own select the same SCN version of the block, if not found is snapshot too old.

In the case of deferred cleanup, even though the corresponding transaction has been commit, it is dirty State itself. The previous commit only updated the SCN on the slot (slot) of the transaction table of the undo segment header, while the Block's own ITL and block SCN were not updated. When you visit this block again, you must complete the rest of the work, that is, the second step above, immediately cleanout--update this block of ITL SCN and BLOCKSCN. Previously said, if clean executes successfully then compare ITL SCN and SELECTSCN to determine if read consistency is required. However, if the undo is overwritten, you can not get the commit SCN, even cleanout can not be executed, it will not compare size . Error or snapshot is too old.


Summary of delay block cleanup, snapshot too old, read consistent

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.