The log writer is the background process responsible for writing transaction information from the redo log buffer (in the SGA) to the online redo log files (on disk).
The Log writer flushes the contents of the redo log buffer when any of the following are true:
- A COMMIT or ROLLBACK issued.
- A log switch occurs.
- Three seconds go by.
- The redo log buffer is one-third full.
- The redo log buffer fills to one megabyte.
The online redo log group that the log writer is actively writing to is the
current online redo log group.
The log writer writes simultaneously to all members of a redo log group and needs to successfully write to only one member in order for the database to continue operating.
The database ceases operating if the log writer cannot write successfully to at least one member of the current group.
When the current online redo log group fills up, a log switch occurs, and the log writer starts writing to the next online redo log group.
The log writer writes to the online redo log groups in a round-robin fashion. Because you have a finite number of online redo log groups, eventually the contents of each online redo log group are overwritten.
If you want to save a history of the transaction information, you must place your database in archivelog mode.
When your database is in
archivelog mode,
after every log switch the archiver background process copies the contents of the online redo log file to an archived redo log file.
In the event of a failure the
archived redo log files allow you to restore the complete history of transactions that have occurred since your last database backup.