[ORACLE] redo and undo _ change Vectors

Source: Internet
Author: User

[ORACLE] redo and undo _ change Vectors
Redo and undo1.1 oracle 9i task execution process

-- DML data update operation:

1. Create a Change vector (Save the data before the change) to describe the change of the undo data block;

2. Create a Change vector (Save the changed data) to describe the change of the data block;

3. merge two change vectors into log records and write them into the log buffer zone.

4. Create an undo record and insert the undo tablespace;

5. Change the data of data blocks;

 

Therefore, the task report is:

-- Task report

1. Create the Change vector of the undo block (data file 2) (The method is to record the content of the undo record)

2. Create a Change vector for the table data block

3a merges two change vectors to create a change record

3b copy change records to the log Buffer

4. Apply the undo block change vector (the redo change vector of the undo record to create the undo record)

5. Apply the table block Change Vector

 

1.2 oracle 9i log buffer bottleneck

All session processes copy the Change vector to the same log buffer.

Introduce redo allocation latch: the user process tries to request redo latch to reserve some space in the log buffer;

There is a problem: a large number of processes compete for redo allocation latch, which consumes CPU resources, and the 'spin 'CPU processes compete for redo latch;

The general situation is that every change, one record, and one log buffer memory allocation of a process

1.3 introduction of private redo buffer and IMU to oracle 10 GB

-- Priate redo log buffer

Oracle 10 Gb introduced.

Each process has a private log buffer. every change in a transaction is written into the private log buffer of the process. After the transaction is committed, the process can obtain the public log buffer.

Private Use of redo allocation latch protection, public use of redo copy latch protection;

 

-- IMU: In-Memory-Undo

Oracle 10 Gb introduction.

A portion of the private log buffer of each process. The process writes the undo redo log to IMU;

IMU is protected by IMU latch. Finally, the IMU record and the priavate redo log buffer log record are merged. Write the public redo log buffer;

 

1.4 oracle10g task processing sequence

-- DML data update operation:

1. Create a Change vector to describe the change of the undo data block;

2. Create a Change vector to describe the changes to data blocks;

3 undo variable vectors are stored in the IMU log buffer.

Table variable vector storage private log buffer

6. Merge the IMU record and Pirvate log buffer record into a change record to end the transaction.

7. Copy the redo change record to the log buffer and change the block.

 

-- IMU

The IMU pool has lacth protection, and the number of pools is = transation/10.

When kb space is used up, the system will be rolled back to oracle9i.

 

-- Storage information of oracle data blocks

Tab 0 row 4 @ 0x1d3f

// Indicates the first block, record 5, and the actual storage address is @ 0x1d3f

Col 0: [2] c1 0a

// The first column, which is a two-character space with the content c10a;

Lb: 0x2

// Lock Information

1.5 redo change vactor (redo change Vector) 1.5.1 description table data block change Vector

Kdo op code: urp row

// Update a row slice

Hdba: ox ***** bdba: ox ****

// Address of the hdba segment header block (segment address)

Bdba: block address

Itli: 2

// Currently, the transaction uses the second transaction slot

Tabn0 slot 4

// Indicates updating the first table and the fifth row of data

Ncol: 4 nnew: 1 size: 4

// The record to be updated has four columns, one of which is more detailed and the length is increased by four;

Col 2 [10] 59 ....

// The second column is finer, with a length of 10 characters.

 

1.5.2 undo records describing the undo actions of data blocks and redo change vectors for the final changes of undo data blocks

Different from Database Change Vectors

Ncol: 4 nnew: 1 size:-4

// When undo is used, the length is reduced by 4.

Col 2 [6] 78 ..

// The second behavior of raw data is 6 Characters

 

-- The redo Change vector of the undo block describes the redo Change vector of the undo record, so it is the same as the final value of the undo record.

Dba (data block address): ox00 ..

// The undo tablespace is a data file 2.

The record is the same as the undo record;

1.6 ACDI of transactions

1 atomicity: process a processes the middle of a transaction (changes the data of Table 1 row 4 ),

Process B access (Table 1 row 4): Access old data through the undo record.

2. Consistency: The data seen by the process is in the old status, new status, and no intermediate status.

3 isolation (independence ):

The default value is: Read submission;

 

For example, process a and process B Modify the same data block at the same time.

4 continuity: To be continued;

 

-- Change the record header: change recode header

Op: 11.5 indicates the alter vector of table redo.

Op: 5.2 indicates the start of the transaction,

OP: 5.1 indicates the undo variable vector.

OP: 5.4 transaction ended

 

-- Read consistency

(1) data blocks must contain pointers to undo records. Transaction a updates the data, and transaction B reads the original data of the undo Record Based on the pointer.

(2) When transaction a1 updates a row of data and transaction a2 updates another row of data, two undo records are generated. Therefore, data blocks (such as a table) must contain pointers of two undo records, in order to ensure that the results of transaction B's query of the entire table are normal.

(3) oracle can only store limited pointers in each data block (one transaction for each member to change the block), and the ITL entries location

(4) If transaction a updates the data block (one table) twice: Transaction B finds the undo record 2 based on entry2 of the ITL table, transaction B hides the transaction a update 2 operation. In the Undo record 2, there is a pointer to entry1 in the ITL table. In transaction B, ITL entry1 is found in the undo record 2 and the undo record 1 is found in the ITL entry1;

The data in the table read by transaction B shields the changes made by transaction a to the two rows;

(5) the memory of transaction B generates a copy of the table, and then copies the two undo records of transaction a to the copy.

(5) read consistency: pointer linked list for a table and all undo records of the table

 

-- Rollback

(1) rollback is the history of a transaction. A pointer linked list (for example, two operations on one column of a row) with the correct sorting of the undo records of a firm is required, generate two Undo records );

(2) The difference between rollback and read consistency: read consistency refers to the data cache in the READ memory. After reading the data, it is quickly discarded.

Rollback is to obtain the current data block and apply the undo record to restore it.

Current block, indicating the version to be written to the disk;

Because it is the current block, all changes will generate redo;

(3) If the undo record has been rolled back for use, undo has a user undo applied mark;

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.