RedoAndundo1.1 Oracle 9iTask Execution Process
--DML Update Data operations:
1. Create a change vector (data before saving changes) to describe the change of undo data Block;
2. Create a change vector (save the changed data), describe the change of the data block;
3. Merge two change vectors for logging, write to the log buffer
4. Create an undo record to insert the undo table Space;
5. change the data of the block;
So the task is reported as:
-- mission report
1. Create a change vector for the undo block (data file 2) (method to record the contents of the undo Record)
2. Create a change vector for table data blocks
3a Merge two change vectors , create change record
3b Copy the change record to the log buffer
4 Apply the undo block to change the vector (undo Record of the redochanges vector, create an undo record)
5 applying a table block to change vectors
1.2 Oracle 9iLog Buffer bottleneck
All session processes replicate the change vectors to the same log buffer.
Introduced redo allocation latch: The user process attempted to request Redo latch to reserve some space in the log buffer;
There is a problem: a lot of process contention redo allocation latch, consumes CPU resources,' spin ' CPU process cycle contention redo latch;
Overview for each change in a process, one record, one log buffer memory allocation
1.3 Oracle 10gIntroducedPrivate Redo BufferAndIMU
--priate Redo Log Buffer
Introduced by Oracle 10g .
Each process has a private log buffer, and each change in a transaction is written to the private log buffer of the process, and after the transaction commits , the process obtains a common log buffer.
Private use redo allocation latch protection, public use redo copy latch protection;
--imu:in-memory-undo
Introduced by Oracle 10g .
Part of the private log buffer for each process. The process writes the undo Redo Log to the IMU;
IMU uses imu latch to protect. The last IMU Record is merged with the priavate redo log buffer record. Write to the public redo log buffer;
1.4 oracle10gTask Processing Order
--DML Update Data operations:
1. Create a change vector to describe the change of undo data Block;
2. Create a change vector to describe the change of the data block;
3 undo Change Vector in IMU log Buffer
Table Change vector store private log buffer
6. Merge the IMU record and pirvate log buffer records into a single change record to end the transaction
7. Tell the redo change record to copy to the log buffer and change the block.
--imu
IMU Pool has lacth protection, pool number =TRANSATION/10
When the 124KB space is fully used, the mechanism of fallback to oracle9i
Storage information for --oracle data blocks
Tab 0 Row 4 @0x1d3f
// indicates the first block, record 5, the actual storage address is @0x1d3f
Col 0:[2] C1 0a
// first column, two characters of space, content is c10a;
lb:0x2
// lock information
1.5 Redo Change Vactor(Redo change vector)1.5.1DescribeTableData block Change vector
Kdo op code:urp row
// update row slices
hdba:ox**** bdba:ox****
Address of //HDBA Segment Header (segment address)
BDBA: block Address
Itli:2
// current transaction uses a second transaction slot
Tabn0 Slot 4
// means update first table, row fifth data
Ncol:4 nnew:1 Size:4
// The record to be updated has 4 columns, the finer of which 1 columns, the length increases 4;
Col 2 [10] 59 59 ....
// finer for the second column, added after a length of ten characters
1.5.2Description Data BlockundoAction ofundoRecords andundoRedo change vector of final change of data block
differs from database change vectors
Ncol:4 nnew:1 size:-4
When //undo , the length is reduced by 4 .
Col 2 [6] 78 78..
// raw Data second behavior 6 characters
The redo change vector of the --undo block, which describes the redo change vector of the undo Record, is the same as the final value of the undo record.
Dba ( data block address ):ox00.
//undo table space for data files 2
Record the same as the record of undo ;
1.6of the transactionACDI
1 atomicity:A process processes the middle of a transaction (changes the data of table 1 row 4 ),
B Process Access (table 1 , row 4): Access old data through the undo record.
2 Consistency: The process sees data as: Old state, new state, no intermediate state
3 Isolation (Independence):
The default is: Submit read;
As a process, theB process modifies the same data block at the same time.
4 Persistence: to be continued;
-- changing the record head: Changerecode header
op:11.5 indicates table redo Change vector
op:5.2 represents the beginning of a transaction,
op:5.1 = undo Change Vector
op:5.4 Transaction End
-- Read consistency
(1) the data block needs to contain a pointer to the undo record. Transaction A updates the data, and transaction B reads the original data of the undo record based on the pointer.
(2 ) transaction Span style= "color:red" >a1 update row of data, transaction a2 Update another row of data, resulting in two undo so data blocks (such as containing a table) should contain 2 undo A record of the pointer to guarantee the transaction b The result of querying the entire table is normal.
(3)Oracle only allows a limited number of pointers within each block (one transaction for each player changing the block),ITL entries position
(4) If the transactionaTwo updates for data blocks (one table): TransactionsbUnderITLof the tableEntry2Found itundoRecording2, the transactionbThe transaction is hiddenaUpdate2Operation.UndoRecording2There's a pointer pointingITLTableEntry1A pointer to; a transactionbPassundoRecording2Found itITL Entry1,PassITL Entry1Found itundoRecording1;
This transaction B reads the data of the table, which blocks transaction a for two rows of changes;
(5) A copy of the table is generated in the memory of transaction B , and then the two undo Records of transaction a are copied to the copy.
(5) read consistency, pointer linked list of all undo records for a table and this table
-- Roll back
(1) rollback is a transaction history, requiring a firm with an undo record of the correct sort of pointer linked list (for example, a row of a column, two operations, resulting in two undo Records);
(2) The difference between rollback and read consistency: Read consistency is read memory data cache, after reading, quickly discard.
rollback is to get the current block of data and apply the undo record to restore
the current block that represents the version to write to the disk;
because it is the current block, all changes are to produce redo;
(3) If the undo record has been rolled back using, then undo has a tag user undo applied Tag;
--------------------------------------------------------------------------------------------------------------- --------------------------------
Http://blog.csdn.net/clark_xu Xu Changliang Column Original
__________________________________________________________________________________
"ORACLE" redo and undo_ change vectors