Each time you modify these blocks in cachebuffer, you must first generate the corresponding changevector in PGA, and then the serverprocess from PGAcopy to SGAREDOLOG
Each time you modify these blocks in the cache buffer, you must first generate the corresponding change vector in the PGA, and then copy the data from the server process to the SGA REDO LOG
The redo log file is composed of redo records (also known as redo entries. A redo record is composed of a group of change vectors.
Redo record: A set of change vectors. Each redo record is composed of multiple change vectors. During the restoration process, Oracle will ensure that a transaction is either completely restored or not restored. In fact, it is done by recovering all the change vectors in the redo record. If a change vector fails to be restored, all the change vectors in the redo record will fail. Therefore, redo record is the minimum recovery unit for database changes.
Change vector: Indicates in the databaseA data blockWhatOnceChange. A cv only applies to changes of one data block. a cv only contains one change.
The data block can be:
Data block
Rollback block undo block
Data segment header block
Rollback segment header block undo header block
The structure of the Change vector, which contains a header information and body information.
Change vector headerIt mainly includes:
Change # n: Number of the change vector in the same redo record
TYP: change type
CLS: the type of the block corresponding to this modification, which is equal to x $ bh. class.
AFN: absolute file number
DBA: rollback block address
SCN: the SCN at the time of Modification
SEQ: the numbers of different modifications to the same SCN are seq numbers. Note: in oracle, the nature of serial numbers is,Different serial numbers correspond to different contents..
OP: operation code, which consists of two parts: layer code. sub code
Change vector bodyIt mainly includes:
1) change the version number of the data block: oracle will copy the version number from the data block when the change vector is created. During the rollback, the change vector recorded in the redo log file is used, based on the SCN comparison, the data file is submitted to the relevant data file, so that the status of the data file is rolled forward, the version of the recovered data block plus one (the data block of the temporary segment does not generate the change vector ). Note: re-use redo For recover. This is a binary operation process and does not produce SQL!
2) DBA: roll back the block address
3) transaction operation code
4) updated data
Each time you modify these blocks in cache buffer, you must first generate the corresponding change vector in PGA, and then copy the data from server process to sga redo log buffer. The user process generates a redo entries when modifying data. In this case, the redo logs are stored in the pga, And the redo copy latch is required to copy the redo logs in the PGA to the redo log buffer, LGWR can write the target log buffer block to the redo log file only after the process COPY is complete. Redo entries is occupied in memorySequentialSpace, which is written to the redo log file in sequence. The block size is different from that set by the db_block_size parameter, but is fixed in Oracle source code and related to OS, most operating systems are512 bytes. Only when all the redo records contained in a firm are securely landed on the disk can the user process be notified of commit completed. The redo records in the redo log buffer can be completely written or not written.
Because user process writes data to redo log buffer, latch protection is required:
Redo copy latch: Write redo to redo log buffer
Redo allocation latch: Controls log buffer allocation
Obtain redo copy latch when redo copy from PGA to log buffer, obtain redo allocation latch, allocate redo log buffer space, and release redo allocation latch after allocation, the server process then copies the redo information in the PGA to the redo log buffer. After OK, the redo COPY latch is released.