Instance Architecture   «Prev  Next»

Lesson 14 The log-writing process
Objective Explain the functions of the head and tail of the log.

Placing redo log entries, Writing to redo log files

Oracle maintains two important pointers that you should be aware of.
  1. One points to the tail of the log and
  2. the other points to the head of the log.
As changes are made to a database, new redo log entries are always placed at the head of the log. The Log Writer process, on the other hand, always looks at the tail of the log. The Log Writer's job is to continually check the tail of the log to see if there are any new redo log records, and then to write those records to the redo log files as quickly as possible. The following series of images illustrates this process:

check the tail of the log

1) As changes are made to the database, the head is advanced, and new entries are added to the redo log.
1) As changes are made to the database, the head is advanced, and new entries are added to the redo log.

2) As changes are made, the head is advanced, and new entries are added to the redo log.
2) As changes are made to the database, the head is advanced, and new entries are added to the redo log.

3) As changes are made to the database, the head is advanced, and new entries are added to the redo log.
3) As changes are made to the database, the head is advanced, and new entries are added to the redo log.

4) As changes are made to the database, the head is advanced, and new entries are added to the redo log.
4) As changes are made to the database, the head is advanced, and new entries are added to the redo log.

5) At the same time, LGWR is always writing redo log records from the tail of the redo log.
5) At the same time, LGWR is always writing redo log records from the tail of the redo log.

6) Here redo log record #1 has been written, and the tail pointer has been advanced.
6) Here redo log record #1 has been written, and the tail pointer has been advanced.

7) Now redo log record #2 has been written, and the pointer advanced again.
7) Now, redo log record #2 has been written, and the pointer advanced again.

8) These processes can occur simultaneously.
8) These processes can occur simultaneously.

9) The process continues as long as the instance is running.
9) The process continues as long as the instance is running.

  1. As changes are made to the database, the head is advanced, and new entries are added to the redo log.
  2. As changes are made to the database, the head is advanced, and new entries are added to the redo log.
  3. As changes are made to the database, the head is advanced, and new entries are added to the redo log.
  4. As changes are made to the database, the head is advanced, and new entries are added to the redo log.
  5. At the same time, LGWR is always writing redo log records from the tail of the redo log.
  6. Here redo log record #1 has been written, and the tail pointer has been advanced.
  7. Now, redo log record #2 has been written, and the pointer advanced again.
  8. These processes can occur simultaneously.
  9. The process continues as long as the instance is running

Head and Tail of log Files

Specifying Redo Log Writing Process

Timely protection of application data requires use of the log writer process to propagate primary database modifications to one or more standby databases. This is achieved using the LGWR attribute of the LOG_ARCHIVE_DEST_n initialization parameters.
Attribute Example Default
{LGWR|ARCH} LOG_ARCHIVE_DEST_3='SERVICE=stby1 LGWR' ARCH

LGWR attribute

Choosing the LGWR attribute indicates that the log writer process (LGWR) will concurrently create the archived redo logs as the online redo log is populated. Depending on the configuration, this may require the log writer process to also transmit redo log files to remote archival destinations. Choosing the ARCH attribute indicates that the (ARCn) archiver process will create archived redo logs on the primary database and also transmit redo logs for archival at specified destinations. This is the default setting. The LGWR and ARCH attributes are mutually exclusive. Therefore, you cannot specify the two attributes for the same destination.
The LGWR attribute can be specified for individual destinations and this allows you to specify that the log writer process writes to redo logs and archives for some destinations while the archiver process archives redo logs to other destinations.

Log Writing Process - Quiz

Click the Quiz link below to take a short a quiz covering the LGWR process.
Log Writing Process - Quiz