■ Backup Scripts When Blocks Change Frequently
■ Backup Scripts When a Moderate Number of Blocks Change Weekly
Backup Scripts When Few Data Blocks Change
If most data blocks do not change each day, incremental backups will be small and you can plan your strategy around daily incremental backups.
Initial Setup The minimum recommended flash recovery area size on disk is dependent on the how frequent the backups are taken and retention policy used.
If your configured retention policy isREDUNDANCY X and you plan to take a backup everyY days, then the formula for the recommended flash recovery area disk quota is:
Disk Quota =
Size of X copies of database +
Size of one copy of incremental backups + Size of (Y+1) days of archived logs
If you configure your retention policy to a recovery window ofX days and execute your backup script once inY days then you can calculate your required disk quota
by one of two formulas. If X>=Y then the formula for the recommended flash recovery area disk quota is:
Disk Quota =
Size of one copy of database +
Size of (floor(X/Y) + 1) copies of incremental backups + Size of (X * ceil(X/Y) +1) days of archived logs
whereceil(X/Y) is the smallest integer greater than or equal to X/Y and floor(X/Y) is the largest integer less than or equal to X/Y.
If X <Y then the recommended formula is:
Disk Quota =
Size of one copy of database +
Size of 2 copies of incremental backups + Size of (Y +1) days of archived logs
Size your flash recovery area according to the applicable formula.
For this example, assume that the retention policy isREDUNDANCY 1: RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
Also assume that backups will be performed daily.
Daily Script The daily backup script would look like this:
RMAN> RECOVER COPY OF DATABASE WITH TAG "whole_db_cpy";
# Make an incremental backup of the database to the flash recovery area.
RMAN> BACKUP INCREMENTAL LEVEL 1
FOR RECOVER OF COPY WITH TAG "whole_db_copy"
DATABASE;
Assume that there are no backups tagged "whole_db_copy" as of the first day of this backup scheme. The results of running this script daily are as follows:
■ On the first day, theRECOVER statement would have no effect, and the
BACKUP... FOR RECOVER OF COPY would create the initial level 0 database copy.
■ On the second day, theRECOVERstatement still has no effect, as there is no level 1 incremental backup to be applied to the level 0 incremental database copy.
TheBACKUP command creates the first incremental level 1 backup.
■ Each day after that, the incremental level 1 from the previous day is applied over the level 0 database copy, rolling it forward to the time of the incremental
level 1 of the previous day, and a new incremental level 1 is created, containing all changes since the level 1 incremental backup of the previous day.
Assuming that this backup strategy is put into effect on February 1,Table 4–1shows how the flash recovery area contents change over time as a result of the strategy.
(Note that the flash recovery area may contain other files based on other backup activities; this table only represents files related to this strategy.)
To alter the example slightly: if you can size the flash recovery area to hold n days worth of archived logs and incremental backups (where n > 1), then you can alter theRECOVER line toRECOVER COPY UNTIL TIME 'SYSDATE-n'. For example, if the flash recovery area is large enough to hold three days of incremental backups, then you can change the script as follows:
RECOVER COPY OF DATABASE TAG "whole_db_copy" UNTIL TIME 'SYSDATE-3';
# Make an incremental backup of the database to the flash recovery area.
BACKUP INCREMENTAL LEVEL 1
FOR RECOVER OF COPY WITH TAG "whole_db_copy"
Table 4–1 Backup Timeline for Scenario When Few Blocks Change: Version 1 Day Script Effects Flash Recovery Area Contents After Script Sun Feb 1 1. Attempt incremental
update, which has no effect because there is no level 0 backup.
2. Create level 0 backup.
Level 0incremental image copy backup, with SCN as of Sun Feb 1
Mon Feb 2 1. Attempt incremental update, which has no effect because there is no level 1 incremental.
2. Back up level 1 incremental.
Level 0 incremental image copy backup with SCN as of Sun Feb 1, level 1 incremental backup containing changes from Feb 1 through Feb. 2, archived logs from Feb 1 through today
Feb 3 and after
1. Perform incremental update of level 0, rolling it forward to the prcvious day.
2. Back up level 1 incremental.
Level 0 incremental image copy backup rolled forward to previous day's level 1 SCN, level 1 incremental backup with changes for previous 24 hours, archived logs from February 1 through today.
Old incremental backups and archived logs not useful for recovery of the rolled-forward level 0 backup are automatically deleted when more free space is needed in the flash recovery area.
DATABASE;
Every day that you run the script, RMAN rolls forward the whole database copy to an SCN three days before the current time. Hence, the disk quota rules will preserve archived logs and incremental backups created afterSYSDATE-3 (because they are needed to recover the database to an SCN within the last three days.
The following table lists the set of files expected to be in the flash recovery area each day after the daily script for this strategy is run.