Regarding Checkpoint & Dirty Buffers
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Regarding Checkpoint & Dirty Buffers

  1. #1
    Join Date
    Mar 2002
    Posts
    200

    Regarding Checkpoint & Dirty Buffers

    It's very misleading. Some explainaton say that "During checkpoint, dirty buffers are written into the disk" and at someother point we also come across statements like "A checkpoint occurs when the dirty buffers are written to the disk". I mean, which one of them is true? There is a sea of difference between the two hypothesises. Can someone clarify my obscurity?

    Many thanks in advance..

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    DBWR writes dirty buffers to files when one of the following occurs.
    - dirty list reaches a threshold value.
    - A process scans a specified number of blocks in LRU list but doesn't find a free block.
    - a time-out occurs.
    - a checkpoint occurs.

    So, a checkpoint forces DBWR to write dirty blocks to datafile BUT writing of dirty blocks to datafile in other scenarios doesn't force any checkpoint.

    HTH
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  3. #3
    Join Date
    Feb 2001
    Location
    Bombay,India
    Posts
    530

    Re: Regarding Checkpoint & Dirty Buffers

    Hi,
    The truth is "During checkpoint ,dirty buffers are written to the disk".From Oracle 7.3 ,there is a event called the checkpoint event.This event occurs because DBWR is very lazy in writing the dirty database buffers from database buffer cache to the datafiles.Whenever a checkpoint happens,LGWR writes the contents of the redolog buffer to the online redolog files.It then signals DBWR to write the contents of the database buffer cache to the datafiles. Also checkpoint occurs due to various situations such as a log switch,when the database is shutdown normal,transactional or immediate option,when u put ur tablespace in read-only mode or when you take ur tablespace offline with normal option or through checkpoint parameters in ur init.ora parameter file i.e LOG_CHECKPOINT_TIMEOUT and LOG_CHECKPOINT_INTERVAL.


    Regards,
    Rohit nirkhe,oracle/Apps DBA,OCP 8i
    oracle-support@indiatimes.com
    Thanks and Regards
    Rohit S Nirkhe
    rohitsnirkhe@rediffmail.com

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    From the Concepts Guide ...

    "The DBWn process writes dirty buffers to disk under the following conditions:
    * When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes dirty buffers to disk asynchronously while performing other processing.
    * DBWn periodically writes buffers to advance the checkpoint,which is the position in the redo thread (log) from which instance recovery begins. This log position is determined by the oldest dirty buffer in the buffer cache."

    ... and ...

    "Checkpoint (CKPT) At specific times, all modified database buffers in the SGA are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signaling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint."

    Anyhow, I think that both explanations you quote are true - I see no contradiction in them, they are just looking at the process from different angles.

    If you take a checkpoint, all the dirty buffers must be written to disk -- if you write all dirty bufers to disk, you can take a checkpoint.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    Hi

    Dirty Buffers are written to disk only under two circumstances.

    1. When an Oracle process requests data, it searches the data in the buffer cache, and if it finds data, the result is a cache hit. If it cannot find the data, the result is a cache miss, and data then needs to be copied from disk to the buffer.Before reading a data block into the cache, the process must first find a free buffer. The server process on behalf of the user process searches either until it finds a free buffer or until it has searched the threshold limit of buffers. If the server process finds a dirty buffer as it searches the LRU list, it moves that buffer to the write list and continues to search. If an Oracle server process searches the threshold limit of buffers without finding a free buffer, the process stops searching and signals the DBWn background process to write some of the dirty buffers to disk.

    2. When a checkpoint occurs. Checkpoints help to reduce the time required for instance recovery. A checkpoint is an event that flushes the modified data from the buffer cache to the disk and updates the control file and data files. The checkpoint process (CKPT) updates the headers of data files and control files; the actual blocks
    are written to the file by the DBWn process.

    Checkpoint occurs when log switch takes place. or depending on the values of LOG_CHECKPOINT_INTERVAL(blocks) and LOG_CHECKPOINT_TIMEOUT(seconds).

    So you can say during checkpoint, dirty buffers are written to the disk.

    Hope this helps

    Regards
    Amar

    Oops! i need to increase my typing speed :-)
    Last edited by adewri; 01-02-2003 at 05:10 AM.
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  6. #6
    Join Date
    Mar 2002
    Posts
    200
    Originally posted by slimdave
    Anyhow, I think that both explanations you quote are true - I see no contradiction in them, they are just looking at the process from different angles.
    Cmon dude, how do you understand both to be true

    If one says "A" happens due to "B" and the other says "B" happens due to "A", do you feel they are the same (and looking the process from different angle !?!)... Only one can be a "Catalyst" and the other "Reaction". Both can't be both.

    Now coming back to the topic, I guess most want to say that "During Checkpoint, DBWR writes from buffers to files".

    See this exact extract from SYBEX Series for OCP DBA 8i - which says - "A checkpoint occurs when the dirty buffers are written to the disk" Now does this mean it's an interpretation mistake of SYBEX.. can we conclude that.. I am looking for some Guru's to acknowledge this..

    Regards,
    Quester

  7. #7
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    Originally posted by quester

    See this exact extract from SYBEX Series for OCP DBA 8i - which says - "A checkpoint occurs when the dirty buffers are written to the disk" Now does this mean it's an interpretation mistake of SYBEX.. can we conclude that.. I am looking for some Guru's to acknowledge this..
    Its wrong... By writting dirty blocks to datafile doesn't force or occure checkpoint. You can force checkpoint to write dirty blocks to datafile.. The question is quite well answered by Sanjay.

  8. #8
    Join Date
    Dec 2002
    Location
    India & Australia
    Posts
    68

    Regarding Checkpoint & Dirty Buffers

    Originally posted by Sameer
    Its wrong... By writting dirty blocks to datafile doesn't force or occure checkpoint. You can force checkpoint to write dirty blocks to datafile.. The question is quite well answered by Sanjay.
    It is definetely under the auspicious of the LRU mechanism but the Dirty blocks are subjected to the mechanism of MRU due to which the checkpoint is enforced writing the dirty block back to the datafile.

    So far very good discussion.

    VAST

  9. #9
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Originally posted by quester
    Cmon dude, how do you understand both to be true

    If one says "A" happens due to "B" and the other says "B" happens due to "A", do you feel they are the same (and looking the process from different angle !?!)... Only one can be a "Catalyst" and the other "Reaction". Both can't be both.

    Now coming back to the topic, I guess most want to say that "During Checkpoint, DBWR writes from buffers to files".

    See this exact extract from SYBEX Series for OCP DBA 8i - which says - "A checkpoint occurs when the dirty buffers are written to the disk" Now does this mean it's an interpretation mistake of SYBEX.. can we conclude that.. I am looking for some Guru's to acknowledge this..

    Regards,
    Quester
    I think you are getting distracted by semantics. Writing all dirty buffers to disk allows a checkpoint to be taken, and taking a checkpoint requires that all dirty buffers be written to disk. Both of these scenarios make perfect sense, so there oughtn't to be any confusion.

    If you come across statements that appear to be contradictory, I suggest that you look at the Oracle documentation to resolve the issue. It took me about 60 seconds to do so myself.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  10. #10
    Join Date
    Mar 2002
    Posts
    200
    First of all thanks for all the responses. I am clear that the First point is right and SYBEX has made a mistake either "theoritically" or "English Language Based".


    Originally posted by slimdave
    I think you are getting distracted by semantics. Writing all dirty buffers to disk allows a checkpoint to be taken, and taking a checkpoint requires that all dirty buffers be written to disk. Both of these scenarios make perfect sense, so there oughtn't to be any confusion.
    ..Well.. again, you see you may derive your own way of understanding things to benefit your convinience of notions. But 'ENGLISH' remains the same. A statement of meaning can only be precise..it cannot be "Subjective" left to the imaginations of the reader. A "technical statement" ought to be precise and not poetry. I hope you will agree.

    Your words of "Allows" and "Requires" are your imaginations to suit your notion, it has no bearing on what SYBEX has said as "A checkpoint occurs when the dirty buffers are written to the disk" . To me, I am in no-way supportive to this statement of SYBEX, regardless of how one would want to interpret based on their convinences. In My Honest Opinion, it's a GROSS MISTAKE on SYBEX's part of either "understanding the concepts" or "English Usage". Period.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width