Why excessive redo during Hot Backup

What will happen when you put database in begin backup mode?

Why excessive redo during Hot Backup??

Why fractured blocks will occur when database in begin backup mode?

When you put the db in backup mode, Oracle will take a checkpoint and update the datafile headers with checkpoint SCN and thereafter it will freeze the datafile header, not datafile, so data will be contiously updated in datafiles.

Considering a case, where an Oracle database is installed on Linux platform. The standard Oracle block size is 8K and lets say that OS level data block size is 512K. When we put the db in “Begin Backup” mode, checkpoint will occur and datafile headers will be freezed. When you start copying datafiles using OS command, it is going to copy as per OS block size (512k). Lets say when you start copying, it gave 8 os blocks to copy – that means you are copying 8 x 512k = 4096k / 1024 = 4K 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 then the process get preempted by CPU and it has allocated CPU time to some other important process. Meanwhile 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 4k Oracle block). Here the problem will raise. We copied half of the oracle block before update and half block after update. These type of block is called “Fractured Block”.

Once db is in begin 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.

Then why Oracle has to copy the complete block to redo log files. As you have seen above, during copy of datafile, there can be many fractured blocks, and during restore and recovery it is going to put those blocks back and try to recover. Now assume that block is fractured and oracle has minimum information that it generates in the redo. Under such condition it is not possible for Oracle to recover such blocks, so instead Oracle just copies the entire block back from redo log files to datafiles during recovery process. This will make the datafile consistent, so recovery process is very important which takes care of all fractured blocks and makes it possible to recover a database.

Nagulu Polagani

"We are all apprentices in a craft where no one ever becomes a master."

Latest posts by Nagulu Polagani (see all)