1.9. Describing Retention Policies

The retention policy is the determined length of time that a backup is retained for use in a potential restore. The retention policy is determined by the configuration parameter RETENTION POLICY. This can be displayed with the SHOW ALL command.

Backups can be modified to block or obsolete their status from the retention policy. The commands CHANGE and KEEP modify the backup to be blocked from the retention policy. Two other commands—CHANGE and NOKEEP—obsoletes the backup from the existing retention policy.

Let's walk through an example of modifying a database retention policy:

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
  c:oraclestagi
ngoral01ccf_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
  '/oracle/flash_recovery_area/oral01c
/%rec_area_%s_%p.bak';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
  'C:ORACLEPRODUCT10.1.0DB_1DATABASES
NCFORA101C.ORA'; # default

RMAN>

Next, you should have a retention policy set to a number of days. You will arbitrarily set 30 days retention as a monthly backup retention period. (In real life, this value would be agreed upon by the IT management.) What this means is that backups are kept for only 30 days within the recovery catalog. You will do this with the CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF n DAYS configuration setting, as seen here:

RMAN> configure retention policy to recovery window of 30 days;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
new RMAN configuration parameters are successfully stored

RMAN>

Next, let's create a backup and use the TAG clause to mark this backup with a unique name called MONTHLY_BACKUP. TAG is a clause that identifies a specific name to a backup so that it can be more easily identified. So this backup is governed by the retention policy you created of 30 days:

RMAN> run
2> {
3> allocate channel c1 type disk;
4> backup database format 'db_%u_%d_%s' tag monthly_backup;
5> backup format 'log_t%t_s%s_p%p'
6> (archivelog all);
7> }

Next, you can modify or change this backup so that the backup will not be kept until the end of retention policy. Let's learn how to cause a backup to expire so that it is not protected by the retention policy:

RMAN> change backupset tag monthly_backup nokeep;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=162 devtype=DISK
keep attributes for the backup are deleted
backup set key=6 recid=6 stamp=531831641

RMAN>

Next, you can modify or change the backup to block the 30-day retention policy you just had expire. Let's look at the command that blocks or excludes this backup from expiring in 30 days, which is the existing retention policy. You will set this backup to be kept until 01-DEC-04 by using the KEEP UNTIL TIME clause:

RMAN> change backupset tag monthly_backup keep until time '01-DEC-04' logs;

using channel ORA_DISK_1
keep attributes for the backup are changed
backup will be obsolete on date 01-DEC-04
archived logs required to recover from this backup will expire when
   
this backup expires backup set key=6 recid=6 stamp=531831641 RMAN>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset