Excess Redolog generation during Hot Backup

 Execess redolog generation during hot backup

What happens during tablespace begin backup?

When a tablespace is in backup mode, datafile’s header belonging to the tablespace will be freezed rather than the datafile.So checkpoint happens and update the datafile header with checkpoint SCN and there after it is freezed until we take tablespace out of backup mode.

Since header only freezed,datafile remains as normal and data changes happens continuously to this datafile while in backup mode. So the datafile which coping during backup is inconsistent. That’s reason of execess redolog generation.

Consider an Oracle database is installed on Linux platform.The standard Oracle block size if 8K and lets say that OS level data block size is 512K. Now when we put the tablespace in “Begin Backup” mode checkpoint has happened and datafile header is freezed. You found which are the files related to this tablespace and started copying using OS command. Now when you copy a datafile using OS command it is going to copy as per OS block size.

Lets say when you start copying it gave 8 blocks to copy - that means you are copying 4K [( 512 bytes * 8 )] to backup location. That means you are copying half of Oracle block to backup location. Now this process of copy can be preempted by Server CPU depending on load. Lets say when you started copying after copy of those 8 block [4K, half of Oracle block(8k)], your process get preempted by CPU and it has allocated CPU time to some other important process.

Mean while DBWR process changes that block that you have copied halfway (since datafile is not freezed and only header is freezed, continuous updates can happen to datafile).After a while CPU returns back and gives you next 8 blocks to copy (rest of the half Oracle block).

Copying half of the oracle block taken at time T1 and another half taken at time T2 and in between T1 and T2, data block got changed. Such type of block is called “Fractured Block”. So backup of the datafile is inconsistence.

During recovery,recover won’t possible using this backup. SO Oracle does some tricky while tablespace in backup mode rather than tablespace in normal mode.

Why excess redolog generation during hot backup?

Usually a tablespace is in normal(not in backup mode),when a transaction happens oracle generates redo information and puts in redo log file. This is the bare minimum information that oracle generates in order to redo the information. It does not copy the complete block. Where as a tablespace in backup mode,if a transaction happens and changes any block FOR THE FIST TIME, oracle copies the complete block to redo log file. This happens only during first time. If subsequent transaction updates the same block again, oracle will not copy the complete block to redo, instead it will generate minimum information to redo the changes. Now because oracle has to copy the complete block when it changes for the first time in begin backup mode, we say that excess redo gets generated when we put tablespace in begin backup mode.

Copying the complete block to redo log files because during copy of datafile, there can be many fractured blocks, and during restore and recovery its going to put those block back and try to recover and this will make datafile consistent.

Now it is clear that the purpose of database is in ARCHIVELOG mode for taking hot backup.

 When you take a backup using RMAN, it does not generate excessive redo logs. Because it does not use OS block for copying, instead it uses oracle blocks for copying datafiles.

Comments

  1. Its really good piece of information.

Add Your Comment