In ONLINE operational state, the database system writes redo log entries for all transactions that contain changing SQL statements. The database system can repeat the changes of a completed transaction using redo log entries. Repeating transactions is necessary, for example, if the database system is restarted after a power cut (see Using Log Entries With a Restart or Recovery).
For very special situations, you can temporarily switch off redo log management (see Log Settings).
The redo log management of the database system is primarily responsible for managing the redo log entries. It also has the following tasks:
· The redo log management regularly stores the database parameters and other internal control information for the logging in the log area.
· For a log backup, the redo log management queries whether and how many log entries have to be backed up from the log area.
· When information is queried about the database system, the redo log management returns information about wait statuses and the type of accesses to the log queue.
...
1. A user enters a SQL statement which changes data, such as an UPDATE statement.
2. The user task that executes the associated transaction reserves main memory space in the log queue and then writes the redo log entries for its transactions in a log page of the previously reserved area. Each log page receives a log queue sequential number, which fixes the time when the redo log entry was written to the log queue.
3. The user task releases the reserved area of the log queue for processing by the log writer. It notifies the log writer if it wants to wait for the corresponding log page from the log queue to be written to the log area; this is always necessary for COMMIT and ROLLBACK operations.
4. The log writer reads the redo log entries from the log queue. The log writer always becomes active if a log page is full or if a transaction was completed with a COMMIT or a ROLLBACK.
5. The log writer writes the redo log entries as a log page to the log area. The log writer gives the log page a log sequence number and a timestamp. The log sequence number can be used to determine the unique sequence of the log pages in the log area. The timestamp is required so you can restore the database instance to its status at a certain point in time.
The log writer is configured in such a way that it always writes one and the same log page to the same physical space in the log area. The log writer regularly checks the state of the log area. If the log area is full, the log writer locks the log queue. This means that all transactions that want to enter redo log entries in the log queue are stopped.
Log pages in the log queue, which were not full when the log writer became active, remain in the log queue, are filled and then written to the log area again during the next write process.
6. If the user task waits for the redo log entry to be written, the log writer wakes it up after the writing and informs it of the log sequence number.
If automatic log backup is active, then the log writer ensures that the redo log entries are automatically backed up from the log area. As soon as a certain number of log entries are written, the management information in the log area is copied and savepoints are requested if necessary. If a restart has to be performed, this reduces the restart time.