Block repair is the easiest way to restore a database. It is automatically performed by the system during normal operations of the database, and users can hardly feel it.
Articles: Oracle recovery Internal principles http://www.bkjia.com/search.aspx? Where = nkey & keyword = 19824
7.1 block repair initialization and operations
When a front-end process modifies a buffer, it calls the redo program to apply a Change vector on the buffer. When the front-end process is dead or an error is triggered, the buffer state is inconsistent, block repair is used to fix the buffer state. The repair process includes: (I) reading the block from the disk; (ii) Rebuilding the consistent version of the buffer with the redo log of the current thread; (iii) write the repaired block back to the disk. If the block repair fails for the first time, it will try again for the second time, identify the block as a logical corruption (set the serial number of the block to 0), and then trigger a block damage error.
Block repair is feasible to build a buffer using the redo log of the current thread, because:
1. Block repair cannot use the redo logs of other threads or the redo logs before the last checkpoint of the current thread.
2. Online logs will not be reused until the current thread checkpoint exceeds the log.
3. The data buffer does not need to be restored from the redo log before the last thread checkpoint.
7.2 buffer header RBA Field
The buffer header (a memory data structure) contains the following fields related to block repair:
Low-RBA and High-RBA: Low-RBA are the addresses of the application's first redo log since the last block clearing operation of the data block, high-RBA is the address of the redo log corresponding to the latest change of the data block. The two describe the range of redo logs required to change the data block from the disk version to the latest version.
Recovery-RBA: When the PMON process is executed and all block repairs are completed, it may take a long time to Recover-RBA to record the progress.
7.3 PMON and foreground process calls
If the front-end process reports an error when it calls back and retries the log program, the front-end process executes block repair. If the front-end process does not report an error but freezes, The PMON process executes block repair.
Block repair may take a lot of time and I/O. However, the PMON process can have enough time to perform block repair and ignore other urgent tasks. Therefore, there is a limit on the number of redo log blocks used for each PMON execution block repair (a constant specifies the number of redo log blocks that can be used for each PMON call ). After PMON executes the block repair application's maximum redo log, the Recovery-RBA field of the data buffer is updated to record its progress. When the Recovery-RBA value reaches the High-RBA value, the block repair process for this block ends.