

LGWR writes to redo log files in a circular fashion. See "Managing Archived Redo Logs" for more information. The database requires a minimum of two files to guarantee that one is always available for writing while the other is being archived (if the database is in ARCHIVELOG mode). The redo log of a database consists of two or more redo log files. How Oracle Database Writes to the Redo Log If necessary, the database can roll back these changes. If the redo log buffer fills, or another transaction commits, LGWR flushes all of the redo log entries in the redo log buffer to a redo log file, even though some redo records may not be committed.


Redo records can also be written to a redo log file before the corresponding transaction is committed. Only when all redo records associated with a given transaction are safely on disk in the online logs is the user process notified that the transaction has been committed. Whenever a transaction is committed, LGWR writes the transaction redo records from the redo log buffer of the SGA to a redo log file, and assigns a system change number (SCN) to identify the redo records for each committed transaction. Redo records are buffered in a circular fashion in the redo log buffer of the SGA (see "How Oracle Database Writes to the Redo Log") and are written to one of the redo log files by the Log Writer (LGWR) database background process. When you recover the database using redo data, the database reads the change vectors in the redo records and applies the changes to the relevant blocks. Therefore, the redo log also protects rollback data. Redo entries record data that you can use to reconstruct all changes made to the database, including the undo segments. For example, if you change a salary value in an employee table, you generate a redo record containing change vectors that describe changes to the data segment block for the table, the undo segment data block, and the transaction table of the undo segments. A redo record, also called a redo entry, is made up of a group of change vectors, each of which is a description of a change made to a single block in the database. Redo log files are filled with redo records.
