Undo series learning: undo segments and zones

Source: Internet
Author: User


Undo Series Study: undo segments and zones 1) rollback segments are a piece of space on the disk www.2cto.com 2) when a transaction starts: first, write the data before and after the change to the redo log file. Second, write the data and related transaction information before the change to the rollback segment, and then modify the data in data_buffer_cache. 3) commit does two things: a) Write log B) mark the transaction as inactive in the rollback segment (small transactions will also mark in the buffer cache) 4) undo a) delete operation: undo is the entire data Row B) update operation: undo is only the original image c) insert operation: undo is rowid when rollback: delete operation, write the data in the rollback segment back to the data block update operation, modify the previous image back to the insert operation, and delete www.2cto.com 5 According to the recorded rowid) the query result set is determined based on the time point. 6) The same rollback block and data block are both in sga and are part of database_buffer_cache. 7) the same transaction cannot cross the rollback segment, even if other rollback segments are idle, this large transaction can only use the allocated rollback segment, even if the rollback segment is extended. The following describes the use, expansion, and rollback of a single rollback segment. Assume that a rollback segment contains extent, 5 8) a rollback segment contains at least two zones and 9) each rollback segment has a rollback segment header, which is a data block and records the transaction table information. 10) rollback segments are used cyclically: transactions are used from the second block of extent 1, the number of times that the transaction table of the segment header of the rollback segment at the end of extent 5 is also the number of times that the cyclic use zone spans from one to another. You can query the following: sys @ ORCL> select usn, wraps from v $ rollstat; www.2cto.com usn wraps ---------- 0 1 11 68 12 60 13 79 14 70 15 71 16 67 17 68 11) since the rollback segment is used cyclically, why is it scalable? Assume that there is a transaction that stays in extent 3 and has not been committed. Then, the rollback segment uses extent 2 in a loop, when extent 2 is used up, it is found that extent 3 has uncommitted transactions. Even if the transactions in extent and 1 have been committed, the current transaction cannot use the following extent beyond extent 3, so we have to extend the new extent, which is assumed to be extent 2-1. because the partitions between rollback segments are chained, but the next extent of Node 2-1 is still extent 3. If there are still uncommitted transactions in extent 3 after use of Node 2-1, continue to expand. Rollback segments need to be recycled after expansion. The Smon process recycles all rollback segments every 12 hours. Shrinks indicates the number of times to recycle sys @ ORCL> select usn, optsize, shrinks from v $ rollstat; usn optsize shrinks ---------- 0 0 1 1 1 2 0 3 0 4 1 5 0 6 0 7 0 8 0 9 0 10 0 12 3 www.2cto.com 12) block clearing: the submitted data must be marked as submitted, so that later sessions can access the data without generating consistent reads and directly read the data. If the block has been written to the disk when the transaction is committed, the block will not be cleared at that time, and it needs to be cleared by delay. When the committed block is read by the next session, the session checks the latest transaction status on the block. 13) The most common metric for rollback segments is to view the value of the v $ rollstat field: shrinks is very large. It can be considered that the rollback segment is too small by linwaterbin.

Related Article

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.