LGWR,Log Switches, and Checkpoints

tolywang發表於2006-09-23

Redo Log Buffer and the LGWR Background Process

The oracle server sequentially records all changes made to the database in the redo log buffer.The redo log buffer is used in a circular manner.The redo entries are written to one of the online redo log groups called the current online redo log group by the LGWR process under the following situations:


1. When a transaction commits
2. When the redo log buffer becomes one-third full
3. When there is more than a megabyte of changed records in the redo log buffer.
4. When timeout occurs(every 3 seconds)
5. Before the DBWn writes modified blocks in the database buffer cache to the data files.

Log Switches

LGWR writes to the online redo log files sequentially - that is , when the current online redo log group is filled , LGWR begins writing to the next group ,when the last available online redo log file is filled, LGWR returns to the first online redo log group and starts writing again .

The database administrator can also force log switches.Each time a log switch occurs and LGWR begins writing to a new log group, the oracle server assigns a number known as the log sequence number to identify the set of redo entries.

When a log switch occurs, and event called a checkpoint is initiated.

A log switch is the event during which LGWR stops writing to one online redo log group and starts writing to another.

During a checkpoints:

1. 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 parameter FAST_START_IO_TARGET , if specifed.

2.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:

1.At every log switch
2.when an instance has been shut down with the normal ,transactional,or immediate option
3.When forced by setting the initialization parameters: LOG_CHECKPOINT_INTERVAL,LOG_CHECKPOINT_TIMEOUT,and FAST_START_IO_TARGET
4.When manually requested by the database administrator


Information about each checkpoint is recorded in the ALERT file if the initialization parameter LOG_CHECKPOINT_TO_ALERT is set to TURE. The default value of FALSE for this parameter does not log checkpoint.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84450/,如需轉載,請註明出處,否則將追究法律責任。

相關文章