Buffer Cache Experiment 4

Source: Internet
Author: User
Tags header

The working mechanism and increment checkpoint and Fast_start_mttr_target parameters of CKPTQ

1. Checkpoint Concept--chkpoint

A checkpoint is a database event that is meant to reduce crash recovery crash recovery time.

The checkpoint event is triggered by the background process ckpt, and when the checkpoint occurs, Ckpt notifies the DBWR process to write the dirty database dirtybuffer to the data file, update the data file header, and control the checkpoint information on the file.

The SCN of the data file head is the checkpoint SCN.

How the Checkpoint works:

In the database, data modification, you need to read the data and memory buffer cache, modify the data at the same time, Oracle will record redo redo information for recovery, with redo log information exists, Oracle does not need to commit the transaction to write the changed data back to disk Because it is inefficient to write at once. The redo information exists also after the data has crashed, the data can be recovered. such as power loss, in-memory modified data not written to the data file is lost, the next time the database starts, you can redo the log to repeat the transaction (whether or not committed), that is, roll forward. Restores the database to a pre-crash state, and then the database can be opened for use, after which Oracle rolls back uncommitted transactions.

Checkpoints exist to shorten the time that data is recovered.

When the checkpoint occurs, the SCN called Checkpoint Scn,oracle notifies the DBWR that the modified data, the dirty data dirty before the checkpoint SCN, is written to disk from buffer cache, and after the write is completed, The CKPT process updates the control file and data file headers Accordingly, logging this checkpoint information, and identifying changes.

After the checkpoint has been modified, the data has been written to the data file, and the corresponding redo record in the redo log is useless for instance recovery (physical recovery is useful).

######################################################################

2. Incremental checkpoint concept incremental checkpoint and Ckptq,fileq

Checkpoint queue, Checkpoint QUEUE,CKPTQ;

Inside the database, each dirty block is logged to the checkpoint queue, sorted by Lrba (low RBA the redo block address for the first time to modify the blocks, RBA called Hrba), and if a block of data is modified more than once, The data block is not changed in order on the checkpoint queue.

The CKPTQ information in the buffer header of the non-dirty block is empty.

When an incremental checkpoint is performed, the DBWR is written in the low RBA order from the checkpoint queue, and the modified data can be written in order of precedence, and the instance checkpoint can therefore not be promoted.

At the same time, the CKPT process uses the Lightweight control file update protocol to write the current minimum RBA to the control file, ckpt in the lightweight update, does not overwrite the control file in the data file in the checkpoint information and data file header information, only records control file checkpoint Scn,controlfile Checkpointed at SCN and write enhanced RBA information based on incremental checkpoints.

With an incremental checkpoint, the database can change all writes to incremental, resulting in a significant reduction in the impact on database performance, while checkpoint queues further associate RBA with checkpoints, allowing the checkpoint to determine the starting point for recovery.

Related to CKPTQ are: File Checkpoint queue Fileq and object queue Obj-q

The file checkpoint enhances the performance of the Tablespace checkpoint Tablespace checkpoint, and each dirty buffer is linked to both CKPTQ and FILEQ,CKPTQ, containing the instance of all the buffer that needs to perform the checkpoint. Fileq contains the buffer that is required to perform checkpoints for a particular file, each containing a file queue and using Fileq when performing a tablespace checkpoint request. --The table space offline will touch the published space check Point.

The role of 3.CKPT processes in incremental checkpoints:

The CKPT process monitors the length of the checkpoint queue, and when the checkpoint queue length reaches a certain limit, Ckpt notifies DBWR to write a dirty block

CKPT calculates a target RBA (target RBA) based on parameter settings and I/O speed and busyness, DBWR flushes the dirty blocks before all Target RBA to disk along the checkpoint queue. After Ckpt notifies DBWR Target RBA, CKPT's mission is over. Does not wait for DBWR to finish writing all the dirty pieces before the target RBA.

Notify Dbwr write dirty block, this is ckpt one of the tasks, ckpt another task, is every 3 seconds, to detect a DBWR write progress.

The first block of the checkpoint queue is called the checkpoint location. Dbwr writes dirty blocks along the checkpoint queue, ckpt every 3 seconds to see where the DBWR is written along the checkpoint queue, and set this position to the checkpoint location. In other words, the block before the checkpoint position is a block that has been DBWR flushed to disk.

This 3-second check of DBWR progress is also an important task for ckpt. Ckpt records the checkpoint position in the control file every 3 seconds, as well as other information, such as ' Heartbeat ', which is recorded in the control file.

Ckpt every 3 seconds of work and ckpt regularly triggers DBWR, which together are called-incremental checkpoints.

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.