Oracle Database - Redo Logfiles

Redo log files

Redo log files are operating system files used by Oracle to maintain logs of all transactions performed against the database. The primary purpose of these log files is to allow Oracle to recover changes made to the database in the case of a failure.

An Oracle database must have at least two redo log files, and most databases have more than two. These files are written by the LGWR process in a circular fashion; that is, when the last log file is filled, the first log file is reused.

It is backup of RLBC where it contains information of transaction logs from rlbc buffer. LGWR writes the RLBC information to Redo online logfiles. It is used in recovery purpose, i.e. on instance recovery, crash recovery,.etc. In turn online Redo logfile entries are moved to Archive log.

Inside logfiles we have Groups & Members. In a database, we can have

Groups
  • Min - 2
  • Max - 32
Members
  • Min - 1
  • Max - 8

Member lies inside group. Transaction logs get written in logfile from bottom to top. Mandatory, minimum 2 groups have to be maintained for a database. So, once the transaction log in one group gets filled, it will switch to next available group in the logfile. Now the filled group of transaction logfile will get archived if in case archive mode is enabled. We can also force switch between the groups using the command

	sql>alter system switch logfile

this will force group to switch even though the existing group not yet filled completely. Thus will occur a checkpoint here.

Logfile Status:
For Group

Unused : Newly created group.
Current : Group that is currently writting transaction logs.
Active : Group which got filled with transaction log or been forced switch, then the respective group will be in active state which means ready to get Archive.
InActive : After group got archived, the group becomes inactive.
Clearing : To clear the logfile group without moving to archive log. (unwanted transactions)
Clearing Current : While performing clearing process, if the log contents are not able to read due to error in I/O writing the new log header in the logfile. then it will stay in clearing current status.
For recovery purpose : Active & Current state are mostly used to get group information, V$log is used.
For Member status,

Invalid : Newly created member to the existing group.
Stale : corrupted member or incomplete content in the member.
Deleted : Deleted transaction log member.
Blank or Null : file is in use.

Step 1 : TO CHECK LOG GROUP STATUS
oracle redo log file

Step 2 : TO CHECK MEMBER STATUS
oracle redo log file

Step 3 : Add the new group by using the following command
oracle redo log file

Step 4 : NOW MANUALLY SWITCH LOGFILE
oracle redo log file

IT IS CYCLE METHOD.ONCE CURRENT -> ACTIVE -INACTIVE->CURRENT->INACTIVE
oracle redo log file

ONCE ACTIVE STAGE WRITE TO ARCHIVELOG COMPLETE IT GOES INACTIVE STATE
oracle redo log file

Step 5 : WHEN WE CREATE NEW LOGFILE IT COMES UP UNUSED STATE ONLY
oracle redo log file

Step 6 :Add the new member redo1b to existing group 1 and the new member was invalid
oracle redo log file

Step 7 : DROP LOGFILE MEMBER
oracle redo log file

Step 8 : CLEAR THE 1 ST GROUP IT GOES TO UNUSED
oracle redo log file

The redlog files having different status if u want to drop any member or group you need to consider the status.
NOTE: To drop the member or group, the Status should be UNUSED or INACTIVE.


Step 9 :
oracle redo log file

Step 10 : RENAME OR RELOCATION: FIRST SHUT IMMEDIATE. IT MUST BE MOUNT STAGE ONLY
oracle redo log file


oracle redo log file

oracle redo log file

oracle redo log file

Two mode in archive log,
Archive mode - which will backup redo online logfiles.
No Archive mode - This will not backup redo online logfiles.

Step 11 : TO CHECK ARCHIVE LOG LIST STATUS
oracle redo log file

Step 12 : IF DON'T WANT TO ARCHIVE LOG MODE TO CHANGE NO ARCHIVE LOG MODE.IT WILL BE MOUNT STAGE
oracle redo log file

oracle redo log file


(Oracle Database - Controlfiles)