Saturday, January 13, 2018

CKPT (checkpoint)

CKPT


 A checkpoint is a data structure that defines a system change number (SCN) in the redo thread of a database. Checkpoints are recorded in the control file and in each data file header. They are a crucial element of recovery.

When a checkpoint occurs, Oracle Database must update the headers of all data files to record the details of the checkpoint. This is done by the CKPT process. The CKPT process does not write blocks to disk; DBWn always performs that work. The SCNs recorded in the file headers guarantee that all changes made to database blocks prior to that SCN have been written to disk.

  • A checkpoint identifies a point in time with regard to the Redo Log Files where instance recovery is to begin should it be necessary.
  • A checkpoint is taken at a minimum, once every three seconds.
  • An event called a checkpoint occurs when the Oracle background process DBWn writes all the modified database buffers in the SGA, including both committed and uncommitted data, to the data files
How works CKPT:


Think of a checkpoint record as a starting point for recovery. DBWn will have completed writing all buffers from the Database Buffer Cache to disk prior to the checkpoint, thus those records will not require recovery.
This does the following:
  • Ensures modified data blocks in memory are regularly written to disk – CKPT can call the DBWn process in order to ensure this and does so when writing a checkpoint record.
  •  Reduces Instance Recovery time by minimizing the amount of work needed for recovery since only Redo Log File entries processed since the last checkpoint require recovery.
  • Causes all committed data to be written to datafiles during database shutdown
  • When checkpointing occurs ,its generate SCN (System Change Number) number and its recorded every datafiles header and control files .
If a Redo Log File fills up and a switch is made to a new Redo Log File , the CKPT process also writes checkpoint information into the headers of the datafiles.
Checkpoint information written to control files includes the system change number (the SCN is a number stored in the control file and in the headers of the database files that are used to ensure that all files in the system are synchronized), location of which Redo Log File is to be used for recovery, and other information.
CKPT does not write data blocks or redo blocks to disk – it calls DBWn and LGWR as necessary.

ckpt_execution

1 comment:

  1. You said dbwn write all committed and uncommitted data from buffer to data file . As per my knowledge data files store only committed data how do you sync with redolog file at the time of instance recovery can you explain it with example

    ReplyDelete