Oracle Redo Log Switching and Archiving Interview Question

What is the difference between redo log switching and redo log archiving in Oracle database?

This question is to test your understanding in Oracle instance recovery via online redo logs and archive logs. It is a part of the core knowledge of Oracle database. To answer this question, first briefly describe what is redo log and how it works; then explain different functions and purposes of log switching and archiving. If you are not familiar with redo logs and archive logs, the key to remember is that, When one log group is full, log writing switches to the next group; the filled log group is archived at the time of log switch. Thus log switching and arching happen at the same time; switching is to overwriting (the next log), and archiving is to preserving (the current log).

"Oracle uses redo log files to record change to the database when data transactions or internal Oracle server actions occur. They are also called online logs. There are usually multiple groups of redo logs. A group consists of a redo log file and its multiplexed copies. All logs within a group are identical. An Oracle background process called LogWriter (LGWR) writes redo records from the redo log buffer to all members of a redo log group. When an online redo log group gets filled, the Oracle instance begins writing to the next online redo log group. The process of switching from one online redo log group to another is called a log switch. Log switch also occurs when a log switch operation is requested. Redo log groups are used in a circular fashion, thus logs in each group will be overwritten when the switch to this log group happens."

"Online redo log archiving is an optional mechanism to further protect the data from the loss of integrity, such as the recovery of a database after the loss of a disk. Archiving works when the database is set to the archiving mode. The Archiver (ARCn) process initiates archiving of the filled log group at every log switch. It automatically archives the online redo log group before the log group can be overridden/reused so that all the changes made to the database are preserved. This enables recovery of the database to the point of failure even if a disk drive is damaged."

No comments:

Post a Comment