Friday, November 26, 2021

Managing Oracle RMAN Backup Windows.

4:14 PM Posted by Dilli Raj Maharjan No comments

 






    A backup window is a period of time during which a backup must complete. These windows are driven by the business need. In most cases, RMAN backup windows are set for the non-business hours or time with the least database load. Let's say if you have the least database load between 5 PM till 9PM in the afternoon you prefer to backup during that time and you may set that time as the backup window.

    By default, RMAN backs up the database at the maximum possible speed and it is impacting your database performance and your business. Let's say you have 4 hours between 5PM till 9PM where database load is low but your database backup completes in 2 hours with the maximum possible speed. There is a lot of maths required to reduce the speed to complete backup in 4 hours. Specifying a window will lower down the speed to complete the backup in 4 hours. But if your backup takes 4 hours to complete with maximum possible speed and you specify a window of 2 hours does not increase the speed and completes in 2 hours. Rather it will terminate the RMAN process after 2 hours preserving any backup sets for recovery. RMAN backs up the least recently backed up files first providing the high chances of recovering the whole database from the backups available.

Use the Duration <HH:MM> parameter of the backup command to specify the backup window.


Backup without the window defined. 

The backup ran with the maximum possible speed. Backup completed in 2 mins and 19 seconds.

echo "Backup database;" > /tmp/rman.cmd
time rman target / cmdfile=/tmp/rman.cmd












Backup with the Duration.

I have used the Duration 00:02 clause with the backup command which means that I need to complete the backup in 2 mins. This means that no matter what is the speed of the backup my backup window is 2 mins and need to complete backup before that. In this case, my backup terminated after 2 mins. All the backup sets that are completed are left as it is.


echo "Backup duration 00:05 database;" > /tmp/rman.cmd
time rman target / cmdfile=/tmp/rman.cmd



Validate the backup sets from the broken backup job.

I executed list backup and it listed 2 backup sets for 7 datafiles. In the case below I will be able to restore only 7 datafiles using these backup sets. 

list backup;

Minimizing Backup Load and Duration

      While using DURATION we can run the backup with the maximum possible performance, or run as slowly as possible while still finishing within the allotted time, to minimize the performance impact of backup tasks. In the example below I have used minimize time option with duration to minimize time as much as possible and complete backup within the window. The backup was completed in 3 minutes and 19 seconds.

Minimize Time

To maximize performance, use the MINIMIZE TIME option with DURATION

echo "Backup duration 00:05 minimize time database;" > /tmp/rman.cmd
time rman target / cmdfile=/tmp/rman.cmd



Minimize load

       RMAN monitors the progress of the running backup. It periodically estimates how long the backup takes to complete at its present rate. RMAN slows down the rate of backup and uses full available duration if RMAN estimates that the backup will finish before the end of the backup window. This reduces the overhead on the database associated with the backup and completes the backup within the window. In the example, the elapsed time for the same backup is 4 minutes and 49 seconds. It is pretty close to the window.

echo "Backup duration 00:05 minimize load database;" > /tmp/rman.cmd
time rman target / cmdfile=/tmp/rman.cmd




0 comments:

Post a Comment