Oracle Redo Log And Archive Log

Oracle uses Redo Logs and Archive Logs to ensure that the data written to the database will not be lost once it has been written and can be recovered to the desired moment.

Each modification operation (Update, Insert, Delete, Alter, etc.) made in the database is first written to the Redo Log Buffer.

It is then written to the active Redo Log used by LGWR.

If the database is in archivelog mode, there should be at least 2 redo log files for each database.

One is required for the current use and the other for the archive log.

You must change the size of the redo log file and the number of redo log files in the default installation according to your system needs.

If you create multiple redo log files in an Oracle Single Instance, you always write to one redo log file.

If you are using the RAC architecture, each node has separate redo log files for the database. In this sense RAC also offers us the performance advantage.

Each redo and archive log file has a unique log sequence number.

I would like to point out that this information is useful for our work in the later stages of the article.

I am going to go through an example to make it clearer.

For example, we assume that the database is in archive log mode.

And we have three redo log files.

When the first redo log file is written, the log switch operation is performed and the redo log file is passed to the second redo log file.

As the first redo log file is full, it starts archiving.

The ARCn process copies the full redo log file to the archive log file.

Let’s think the second redo log file is full.

The switch operation is repeated and the third redo log file starts to be used.

The second redo log file is transferred to the archive log by ARCN procecess.

When the third redo log file is full, the first redo log file starts to be used and the third redo log file is transferred to the archive log by the ARCn process.

But before starting to write the first redo log file, the first redo log file must be absolutely archived and the data in it must be written in the data files.

Thus, the first redo log file becomes available again by LGWR.

We mentioned that the Redo Log is vital for ensuring that committed data is guaranteed.

Because of this, oracle presents a multiplexed redo log structure to keep the redo log file in the backup structure.

That is, when writing to a redo log file, it is written to a copy of it, and the log number of the two redo log files is the same.

One of them is being transferred to the archive log.

To be more secure, you need to put this redo log file on different disks.

Multiplexing is done by creating redo log groups.

By creating two different disks for each redo log group and putting one member for each redo log group on each disk, we will ensure that the database will work even if one of the disks goes down.

Actually you can think of doing a RAID operation for redo log.

We said that when the redo logs are full, it will be a log switch operation.

By setting the initialization parameter below, you can also perform a log switch operation for 30 minutes.

 

During recovery, archive and redo logs are applied to the database in increasing order.

dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply