This paper mainly summarizes the mechanism of writing dirty blocks in database.
When a process is going to make changes to the data block
1. Get CBC Latch
2. Modify the buffer pin status
3. Release CBC Latch
4. Generate Redo Records
5. Modify Buffer data block
6. Move the dirty block to the checkpoint queue, so that the modification is complete.
7. Get CBC Latch
8. Modify the buffer pin status
9. Release CBC Latch
The 6th step is described here:
For example, there are 4 blocks on the checkpoint queue, their order is dirty order, when the 6th file No. 322 block is modified, the corresponding log entry will be generated in redo, here the 2.1.322 meaning is 2nd number redo Log 1th block No. 322 bytes. Here the first redo log records 6th number NO. 322 block after the first change of image in the address of the redo, called the low RDA, the next change in the address is called high RBA, where high RBA significance, and low RBA significant. No 3s in Oracle triggers an incremental checkpoint notification DBWR writes dirty blocks, and how much of the dirty blocks are controlled by the parameter fast_start_mttr_target. Here is explained under Fast_start_mttr_target,oracle write dirty block condition is to find the dirty block too much, under what condition is the dirty block too much? Assuming that there are 3,000 dirty blocks, the system will be 1ms per io to recover 3,000 dirty blocks need 3s, and fast_start_mttr_target is to control the instance recovery time, that is, if the downtime I want to restore the database in the time of the value, So this value, in addition to the amount of time each dirty block is written, is the number of dirty blocks that are refreshed, usually by Oracle automatically adjusts to the system hardware and defaults to 300s.
The meaning of low RBA: instance recovery.
How did Oracle recover when the database was suddenly down when it wrote the 2nd dirty block, block 3rd, No. 233, and the dirty data in buffer was gone? In fact, the answer is low RBA, when the instance is restored, Oracle will check the checkpoint queue first low RBA address location, Since block 6th of document No. 322 has been written (note that Oracle puts the database from the checkpoint queue to the Obj-q queue first in the write process) the first record of the checkpoint queue is the low RDA location in the redo of the 3rd file, which is recorded in the control file. In fact, careful observation can be found that the order of checkpoint queue is the order of the redo record, we find the checkpoint queue first need to recover the RDA location can be based on RDA to restore the original checkpoint queue, there are 2 small points to note, first, where the endpoint is actually on disk RDA, This record means that Oracle writes the redo log to the redo location of the disk, and if redo's RBA is greater than this value, then the log buffer is not brushed to disk, and Oracle does not recover it. Second, the second change in block 6th, number No. 322, does not need to be restored, and the database has changed the value of the block to green when it is first turned into a dirty block. When the entry is resumed, green is changed to green, so the low RBA is much more important than the high RBA.
Oracle Checkpoint Queue