The following are the steps involved;
Setting Up a Database for RMAN
Setting Up Recovery Area for RMAN
Setting Up a Database for RMAN
Configuring the Backup Retention Policy
Retention Policy is of two options:
Window-Based Retention Policy
Redundancy-Based Retention Policy
Configuring a Recovery Window-Based Retention Policy:
The recovery window parameters specifies the number of days between the current time and the earliest point of recoverability.
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
The above can recover the database to any point withing the last week.
RMAN does not automatically delete backups rendered obsolute by the recovery window. Instead RMAN marks them as OBSOLUTE in the REPORT OBSOLUTE output.
RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups.
Configuring a Redundancy-Based Retention Policy:
The redundancy parameter specified the number of backups that has to be maintained for the Datafile & Controlfile by RMAN.
RMAN will mark the backups to be obsoluted , if the number of backups for a specific datafile or control file exceeds the Redundancy Setting.
RMAN keeps a track of which ones to retain and which are obsoluted.
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
The above will set RMAN to have only 2 backups of the datafile or controlfile. If a backup is taken after that then the older one will be obsoluted.
RMAN retains all archived logs and incremental backups that are needed to recover the nonobsolete backups.
Configuring Control File and Server Parameter File Autobackup
RMAN can be configured to automatically back up the control file and server parameter file whenever the database structure metadata in the control file changes and whenever a backup record is added.
The autobackup enables RMAN to recover the database even if the current control file, catalog, and server parameter file are lost.
Enabling : CONFIGURE CONTROLFILE AUTOBACKUP ON;
Disabling: CONFIGURE CONTROLFILE AUTOBACKUP OFF;
The following command will configure RMAN the autobackup to write to an ASM DiskGroup
ASM Instance :
(To create the disk group )
CREATE DISKGROUP CONTROL
NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK 'ORCL:ASMD6'
FAILGROUP failure_group_2 DISK 'ORCL:ASMD7';
RMAN :
CONFIGURE CONTROLFILE AUTOBACKUP
FORMAT FOR DEVICE TYPE DISK TO '+CONTROL';
Optimizing the RMAN Backup:
Backup file optimization can be used to prevent repeat backups of read-only tablespaces and archive logs:
Read-only and offline-clean data files are only backed up once per recovery window.
The command BACKUP ARCHIVELOG ALL only backs up logs that are not already on tape.
The command BACKUP BACKUPSET ALL copies to tape all backup sets that do not already exist on tape.
Backup optimization is configured using:
CONFIGURE BACKUP OPTIMIZATION [ON | OFF | CLEAR];
Once you are done with the RMAN Configuration now we have to Setup the Flash Recovery Area.
Setting Up Recovery Area for RMAN
The flash recovery area feature lets you set up a location on disk where the database can create and manage a variety of backup and recovery-related files.
Using a flash recovery area simplifies the ongoing administration of your database by automatically naming files, retaining them as long as they are needed for restore and recovery activities, and deleting them when they are no longer needed to restore your database and space is needed for some other backup and recovery-related purpose.
Choosing a Location for the Flash Recovery Area:
When setting up a flash recovery area , we need to specify a location. The Location can be a Directory or ASM Disk Group to hold the files.
Files That Can Be Stored in the Flash Recovery Area:
Files are classified as permanent and transient.
Permanent are the control files and online redolog files , all the other rest of the files are transient as RMAN will delete the files when they become obsoulte based on the retentition policy defined.
Planning the Size of the Flash Recovery Area:
The size should be large enough to hold the following;
A copy of all datafiles
Incremental backups, as used by your chosen backup strategy
Online redo logs
Archived redo logs not yet backed up to tape
Control files
Control file autobackups (which include copies of the control file and SPFILE)
Setting Initialization Parameters for the Flash Recovery Area
Two key initialization Parameters are involved in setting up the flash recovery area.
DB_RECOVERY_FILE_DEST_SIZE - which specifies the disk quota, or maximum space to use for flash recovery area files for this database
DB_RECOVERY_FILE_DEST - which specifies the location of the flash recovery area
In our case we are going to use a Disk Group for the Destination which is of 2GB;
ASM Instance:
CREATE DISKGROUP ARCH
EXTERNAL REDUNDANCY
DISK 'ORCL:ASMD8','ORCL:ASMD9','ORCL:ASMD10','ORCL:ASMD11';
ASM Enabled Instance:
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ---
db_recovery_file_dest string +ARCH
db_recovery_file_dest_size big integer 2G
SQL>
LAB:
Connect to the ASM Instance and Create the DiskGroup for the Control File Autobackup
SQL> CREATE DISKGROUP CONTROL
NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK 'ORCL:ASMD6'
FAILGROUP failure_group_2 DISK 'ORCL:ASMD7';
Diskgroup created.
SQL>
SQL> CREATE DISKGROUP ARCH
EXTERNAL REDUNDANCY
DISK 'ORCL:ASMD8','ORCL:ASMD9','ORCL:ASMD10','ORCL:ASMD11';
Diskgroup created.
SQL>
Connect to RMAN and configure the Settings
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN>
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+CONTROL';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+CONTROL';
new RMAN configuration parameters are successfully stored
RMAN>
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored
RMAN>
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Starting backup at 30-MAR-07
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=6 recid=1 stamp=617555015
input archive log thread=1 sequence=7 recid=2 stamp=617743035
input archive log thread=1 sequence=8 recid=3 stamp=617744460
input archive log thread=1 sequence=9 recid=4 stamp=617747694
input archive log thread=1 sequence=10 recid=5 stamp=618009531
input archive log thread=1 sequence=11 recid=6 stamp=618356756
input archive log thread=1 sequence=12 recid=7 stamp=618357083
input archive log thread=1 sequence=13 recid=8 stamp=618360354
input archive log thread=1 sequence=14 recid=9 stamp=618360687
input archive log thread=1 sequence=15 recid=10 stamp=618567572
input archive log thread=1 sequence=16 recid=11 stamp=618571214
channel ORA_DISK_1: starting piece 1 at 30-MAR-07
channel ORA_DISK_1: finished piece 1 at 30-MAR-07
piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092016_0.287.618571219 tag=TAG20070330T092016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:29
Finished backup at 30-MAR-07
Starting backup at 30-MAR-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=+DATA/odb/datafile/system.256.617411373
input datafile fno=00003 name=+DATA/odb/datafile/sysaux.257.617411377
input datafile fno=00002 name=+DATA/odb/datafile/undotbs1.258.617411379
input datafile fno=00004 name=+DATA/odb/datafile/users.259.617411381
channel ORA_DISK_1: starting piece 1 at 30-MAR-07
channel ORA_DISK_1: finished piece 1 at 30-MAR-07
piece handle=+ARCH/odb/backupset/2007_03_30/nnndf0_tag20070330t092148_0.286.618571311 tag=TAG20070330T092148 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:50
Finished backup at 30-MAR-07
Starting backup at 30-MAR-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=17 recid=12 stamp=618571546
channel ORA_DISK_1: starting piece 1 at 30-MAR-07
channel ORA_DISK_1: finished piece 1 at 30-MAR-07
piece handle=+ARCH/odb/backupset/2007_03_30/annnf0_tag20070330t092547_0.283.618571549 tag=TAG20070330T092547 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 30-MAR-07
Starting Control File and SPFILE Autobackup at 30-MAR-07
piece handle=+CONTROL/odb/autobackup/2007_03_30/s_618571551.256.618571557 comment=NONE
Finished Control File and SPFILE Autobackup at 30-MAR-07
RMAN>
Summary : We have configured RMAN to Backup an ASM Enabled Instance.
Other ASM Interesting Topics