|Lesson 10|| Oracle cycles through redo logs|
|Objective||Explain how Oracle cycles through redo log files.|
Oracle cycles through Redo Logs
Multiple redo log files
Oracle writes to redo log files in a cyclical fashion, first writing to one group, then another, and so forth, eventually coming around once again to the first group.
We will examine how to specify these groups later in the course. The very first time that you create and start a database, Oracle will open the first group of redo log files.
As you make changes to the database, Oracle writes a record of those changes to the redo logs. When the first group fills up, Oracle starts to write changes to the second group.
This process continues for the life of the database. Flip through the following SlideShow to see this process in action.
Cycling through Redo Logs
Why multiple redo log files are needed
An Oracle database must always have a minimum of two redo log groups. The reason for this is the cyclical process that you just saw in the SlideShow.
When one redo log group fills up, Oracle needs to be able to start writing another. Oracle cannot overwrite the redo log file that it just filled.
At a minimum, you must have two groups, so that you can alternate back and forth between the two.
The log switch
The point at which Oracle advances from writing one redo log group to writing the next is known as a log switch
When a log switch occurs, Oracle must ensure that the new redo log group is no longer needed for recovery. If any of the records in that redo log group reflect
changes that still exist only in memory, then Oracle must write the affected data blocks to disk before the log switch can take place.
Oracle keeps track of this for you, and ensures that it happens.
Here is why Oracle does this
If archive log mode is on, Oracle will also need to ensure that the next redo log group has been archived before proceeding with the log switch.
This will be covered in more detail later in the course.