Checkpoint in Oracle

Source: Internet
Author: User
What is checkpoint?

A checkpoint is a database event that refreshes modified data from the cache to the disk and updates control files and data files.

When does checkpoint occur?
We know that the checkpoint will refresh the dirty data, but when will the checkpoint happen? In the following situations, checkpoint is triggered.
1. When a log group is switched
2. When the log_checkpoint_timeout, log_checkpoint_interval, fast_start_io_target, fast_start_mttr_target parameters are set
3. When you run alter system switch logfile
4. When you run alter system checkpoint
5. When you run alter tablespace XXX begin backup and end backup
6. When you run alter tablespace and datafile offline;

Incremental checkpoint)
The incremental checkpoint mechanism was introduced after oracle8. In previous versions, a full thread checkpoint will be implemented for each checkpoint. In this way, all dirty data will be written to the disk, the huge I/o has a great impact on system performance. To solve this problem, oracle introduces the checkpoint queue mechanism. Each dirty block is moved to the checkpoint queue and arranged according to low rdb (the first time the corresponding redo block address is modified for this block, the low rba value of data blocks near the end of the checkpoint queue is the smallest, and the order of these blocks in the checkpoint queue will not change after they are modified again, this ensures that the earlier the modified block is written to the disk. Ckpt updates control files and data files every three seconds to record checkpoint execution.

Data Dictionary
Full checkpoint

Select * from X $ KCCRT where indx = 0;

It is shown that the last full checkpoint occurred at 18:49:37 on 06/25/2004, So we infer that a log switch occurred at 18:49:37 on 06/25/2004, and then go to the operating system to view the production archive, there was an archive production.
-Rw-r ----- 1 oracle oinstall 83532800 Jun 25 116948.dbf

Incremental checkpoint

Select * from X $ KCCCP where indx = 0;

 


The following information is displayed: low-rba, on-disk rba, and checkpoint time.

Ckpt updates control files and data files every three seconds to record checkpoint execution.

Only the control file is updated. Every 3 seconds, the data file is not updated. This statement is correct, but not detailed enough. It should be said that the ckpt process only tells dbwr each time due to the principle of the incremental check point and checkpoint queue, writing dirty buffer will always write to the latest location. It only tells dbwr an end point in the checkpoint queue, and ckpt reports the latest location of dbwr written in the control file every 3 seconds. In this way, for example, when the database is to be restored (instance recovery), it can be restored from this latest location, rather than from the checkpoint SCN in the data file, which will shorten the recovery time, especially when instance crash is enabled

In addition, when a checkpoint occurs, ckpt updates the data file header and control file instead of updating the SCN at the current checkpoint, instead, it updates the SCN when the last dbwr was written to the completed checkpoint. That is to say, the update control file and Data File Header lags behind the checkpoint, this principle of recovery is also easy to understand, because the dirty buffer has not been written when the checkpoint occurs, and naturally it cannot be updated to the current SCN immediately.
 

Related Article

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.