在书上看到 checkpoint 
 
请教什么是 checkpoint ?        这么使用 checkpoint?

解决方案 »

  1.   

    一般所说的checkpoint是一个数据库事件(event),checkpoint事件由checkpoint进程(LGWR/CKPT进程)发出,当checkpoint事件发生时DBWn会将脏块写入到磁盘中,同时数据文件和控制文件的文件头也会被更新以记录checkpoint信息。
    topcheckpoint的作用
    checkpoint主要2个作用:   1. 保证数据库的一致性,这是指将脏数据写入到硬盘,保证内存和硬盘上的数据是一样的;
       2. 缩短实例恢复的时间,实例恢复要把实例异常关闭前没有写出到硬盘的脏数据通过日志进行恢复。如果脏块过多,实例恢复的时间也会很长,检查点的发生可以减少脏块的数量,从而提高实例恢复的时间。通俗的说checkpoint就像word的自动保存一样。
      

  2.   

    Oracle fundamental中的原文:
    Checkpoints
    During a checkpoint:
    • A number of dirty database buffers covered by the log being checkpointed are written to
    the data files by DBWn. The number of buffers being written by DBWn is determined
    by the FAST_START_MTTR_TARGET parameter, if specified.
    Note: The FAST_START_MTTR_TARGET parameter is covered in detail in the Oracle9i
    DBA Fundamentals II course.
    • The checkpoint background process CKPT updates the headers of all data files and
    control files to reflect that it has completed successfully.
    Checkpoints can occur for all data files in the database or for only specific data files.
    A checkpoint occurs, for example, in the following situations:
    • At every log switch
    • When an instance has been shut down with the normal, transactional, or immediate
    option
    • When forced by setting the initialization parameter FAST_START_MTTR_TARGET.
    • When manually requested by the database administrator
    • When the ALTER TABLESPACE [OFFLINE NORMAL|READ ONLY|BEGIN
    BACKUP] cause checkpointing on specific data files.
    Information about each checkpoint is recorded in the alert_SID.log file if the
    LOG_CHECKPOINTS_TO_ALERT initialization parameter is set to TRUE. The default value
    of FALSE for this parameter does not log checkpoints.管理员也可以强制进行checkpoint操作:
    Forcing Log Switches
    A log switch can be forced using the following SQL command:
    ALTER SYSTEM SWITCH LOGFILE;
    Forcing Checkpoints
    A checkpoint can be forced using the following SQL command:
    ALTER SYSTEM CHECKPOINT;
      

  3.   

    checkpoint 时,控制文件中的 scn 和 数据文件头的 scn 是一致的。checkpoint 之前的数据是保证一致性的。 
      

  4.   

    checkpoint事件由checkpoint进程(LGWR/CKPT进程)发出
    它的作用就是保持数据文件、日志文件、控制文件同步
    如果不同步,那肯定是数据库出错了
    checkpoint进程产生检查点时,数据文件、日志文件、控制文件文件名是一样的