Oracle logs include online redo log and archived log.
Online redo log:
A database must have at least two groups of redo logs, and each group of redo logs must have at least one member (for security reasons, we recommend that each group of redo logs have at least two diversified redo log member)
Redo logs are used cyclically. When a group of logs is full, the system switches to the next group of logs. In non-archive mode, when all the log groups are fully written, the log groups that have been fully written before and are inactive are overwritten to achieve the purpose of recycling.
In archive mode, when all the log groups are full, LGWR waits until all the logs are archived and all the transaction data recorded in the logs are written to the disk (inactive) before overwriting the previous log group. Otherwise, it will wait until these tasks are completed.
Log content:
The redo entry of the redo log is composed of a set of change vectors.
Change vector: Changes in data, undo changes, and undo segment Changes
Example: to modify the value of a field in a table, the field value before modification will be placed in undo. In order to apply for this transaction, you also need to modify the information of the transaction table in the undo segment field header. The description of this process is
The Change vector of the redo log.
The information of the Change Vector includes the version number, the transaction operation code, and the changed data block address. When a change vector is created, the version number is copied from the data block. During restoration, Oracle reads the vector and applies the modification to the corresponding data block.
Add 1 to the version number of the data block.
Redo Thread log Thread
Single Instance: One redo thread
RAC: the number of instances and redo threads is. Each instance has its own thread
The introduction of redo thread aims to avoid contention caused by sharing redo log files among multiple instances, thus improving database performance.
Generally, thread number = instance number
In the RAC environment, you must specify the thread for adding logs:
Alter database add logfile thread 1 GROUP 5
('+ DATA1/oradata/redo06.log', '+ DATA1/oradata/redo06.log') size 10 m;
ALTER DATABASE ADD LOGFILE MEMBER
'... To group 5;
Each redo thread or instance requires at least two groups of logs, which are used cyclically. When a group of logs is full, a log switch event occurs and the next group of logs is used. If the database is in archive mode,
The archived log is also archived. During log switch, incremental checkpoints are triggered to start the DBWR background process to write the dirty block involved in all operations recorded in the LOG from the data buffer to the disk file.
Once the checkpoint is completed, this log group can be overwritten and reused.