The online redo log stores a copy of the changes made to data. If a failure requires a data file to be restored from backup, then the recent data changes that are missing from the restored data file can be obtained from the online redo log files, so work is never lost. The online redo log files are used to recover a database after hardware, software, or media failure. To protect against a failure involving the online redo log file itself, Oracle Database can multiplex the online redo log file so that two or more identical copies of the online redo log file can be maintained on different disks.
The online redo log for a database consists of groups of online redo log files. A group consists of an online redo log file and its multiplexed copies. If necessary, the database can roll back these changes. The redo log of a database consists of two or more redo log files. See "Managing Archived Redo Logs" for more information. LGWR writes to redo log files in a circular fashion. When the current redo log file fills, LGWR begins writing to the next available redo log file.
When the last available redo log file is filled, LGWR returns to the first redo log file and writes to it, starting the cycle again.
Figure illustrates the circular writing of the redo log file. The numbers next to each line indicate the sequence in which LGWR writes to each redo log file. Filled redo log files are available to LGWR for reuse depending on whether archiving is enabled.
Oracle Database uses only one redo log files at a time to store redo records written from the redo log buffer. The redo log file that LGWR is actively writing to is called the current redo log file. Redo log files that are required for instance recovery are called active redo log files. Redo log files that are no longer required for instance recovery are called inactive redo log files. A log switch is the point at which the database stops writing to one redo log file and begins writing to another.
Normally, a log switch occurs when the current redo log file is completely filled and writing must continue to the next redo log file. However, you can configure log switches to occur at regular intervals, regardless of whether the current redo log file is completely filled. You can also force log switches manually.
For each database block when it is written to disk, the database computes a checksum for it, and it will be stored in the header of the block. You can check for errors in the alert log because whenever an error is detected either while writing to an archive log or at the time of recovery, the error is logged in the alert log.
In case of corruption for any of the members, Oracle will try to read any other member in the same group for archiving. In case all the members of the group are corrupted, the archiving is not possible. This is the reason why it is recommended to multiplex the log members i. The Redo Log file should be cleared when it is found to be corrupt and unusable. It does not matter if it was archived or not, it is required to clear the log file before you can use it.
The commands to clear the Redo Log are given in a later section of this article, which does not require a database reboot. By multiplexing, Oracle will maintain two or more identical copies grouped together of the Redo Log in separate locations.
When multiplexing Redo Logs, make sure that the different members in the same group go to different disks for better recoverability.
In this case, even if one disk fails, you will have the member on the other disk for recovery of the database instance. You can fetch the complete details about the existing groups, their members and the count using the following command:. To start multiplexing a Redo Log file, you will first need to determine the number of existing groups and members.
You can do this using the following command:. Once you have the information about the groups and its member, you can use the alter table command to another a log file to a group of your choice as follows. You can verify whether the switch was successful or not by monitoring the list of groups.
The current group will now have a new status of active, whereas the next group will now become the new current group. You can move your online Redo Logs by shutting down your database by using the alter database command as follows:. In case you want to create a new Redo Log file-based group for your Oracle database, you can do this, using the alter database command, along with the add logfile parameter as follows:.
To drop an existing member of your Redo Logs, you can use the alter database command, along with the drop logfile member clause as follows:. In case you want to clear out your Redo Log files in a situation of an unexpected failure or corruption, you can use the alter table clear logfile command as follows:. To avoid archiving a log file that you want to clear, you can use the unarchive parameter in your command as follows:.
The following data dictionary views give information about Redo Logs and groups. You may call these views based on what you are looking for in the Redo Logs. If you want an easier alternative to transfer data from your Oracle database without having to use Oracle Redo Logs described above, you can use an automated data integration solution such as Hevo.
0コメント