Skip to content

RMAN : CONFIGURE YOUR RMAN ENVIRONMENT

To work with RMAN, you must configure several things, which can be default backup type (disk or tape), the number of channels you want to use, and the degree of parallelism.

When you are testing it on your personal system, you probably can get by with RMAN’s default configuration settings. However, for production jobs involving sophisticated backup strategies, you need to customize RMAN’s configuration settings to fulfill all your requirement. You can configure different backup retention policies, for example, for different databases.

EXAMPLE CASE

Oracle Datbase version 11gR2 (11.2.0.4)

A) REQUIREMENTS

We have to meet below requirements for our database:

– Database to backup: BRIJ
– RMAN Catalog Database: RMANDB
– Base recovery catalog owner: rman
1) Backup complete database every night

2)  Keep last two Backups only

3)  Use Disk for keeping the backup pieces.

4)  Control File is to be automatically backed up every time a back up is taken

5)  Control file backups are to be stored on disk in the ‘/backups/brij’ directory.

6)  Backups should be made using backup sets

7) Backup pieces should be stored on disk in the /backups/brij directory.

8)  Each backup set piece size should be 2GB or smaller

9)  Backups should be in compressed format in order to save storage space

 

B) CHECK THE PRESENT CONFIGURATION

The ‘show all’ command displays both settings that you have configured and any default settings. Any default settings will be displayed with a # default at the end of the line. Because RMAN settings are stored in the control file, your target database must be mounted or open when issuing the show command

RMAN> show all;

RMAN configuration parameters for database with db_unique_name BRIJ 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 ‘%F’; # default
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 MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128′; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/oracle/DB11G/product/11.2.0/dbhome_1/dbs/snapcf_brij.f’; # default

Let us first understand each of the current configuration:

 i)CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

It means that RMAN retains only one set of backup copies.

ii)CONFIGURE BACKUP OPTIMIZATION OFF; # default

It means that by default RMAN won’t skip the backing up of unchanged data blocks in the datafiles OR in other words, It will NOT allow Oracle to skip backups of files that already have identical backups on the device being backed up to.

iii)CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

It means that by default RMAN sends backup output to a disk drive.
Disk device, disk is the default device type for all automatic channels.

iv)CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

It means that by default RMAN doesn’t automatically back up the control files when it performs a backup task.
If you set this parameter to ON, SPFILE will also be automatically included in the control file backup piece. You should keep it ON and specially it is highly recommended to enable the control file autobackup feature ON if you aren’t using a recovery catalog.

Once you make it ON, RMAN will automatically back up your target database control file, as well as the current server parameter file, during any following events occurs:

• Successful completion of backup/copy command
• After create catalog command.
• Any structural changes (adding/dropping tablespace/datafiles etc) to the database that modify the contents of the control file

Note: Even when the autobackup feature is disabled, RMAN will back up the current control file and the server parameter file whenever any backup command includes datafile 1 (system tablespace,) from the datafiles that belong to the target database.

v)CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default

%F means the database ID, day, month, year, and sequence
If you haven’t enabled a flashback area, RMAN will create the autobackups in an operating system–specific location ($ORACLE_HOME/dbs on Unix)

vi)CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

It means that the default RMAN backup type is a backup set (and not an image copy) and the degree of parallelism is 1. It is best to allocate only one channel for each physical device on the server.

vii) CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

It means that by default RMAN doesn’t make multiple copies of a backup file. Generally this parameter is used if you want to place one copy of a backup set in two different locations on disk:

viii) CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

It means that by default RMAN doesn’t make multiple copies of archivelog file.

ix) CONFIGURE MAXSETSIZE TO UNLIMITED; # default

It means that there’s no limit on the size of a backup set by default.

x) CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

It means that by default RMAN backups aren’t encrypted.

xi) CONFIGURE ENCRYPTION ALGORITHM ‘AES128′; # default

By default, RMAN uses the AES 128-bit key algorithm for encryption.

By querying the v$rman_encryption_algorithms view, a list of RMAN encryption algorithms can be obtained:

SQL> select algorithm_id, algorithm_name, algorithm_description, is_default from v$rman_encryption_algorithms;

ALGORITHM_ID ALGORITHM_NA ALGORITHM_DESCRIPTION IS_DEFAULT
———— ———— —————————————————————- —
1 AES128 AES 128-bit key YES
2 AES192 AES 192-bit key NO
3 AES256 AES 256-bit key NO

xii) CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default

You can configure the BASIC compression algorithm.
Only If you have enabled the Oracle Database 11g Release 2 Advanced Compression Option, you can set it to HIGH, MEDIUM & LOW

HIGH: Best suited for backups over slower networks where the limiting factor is network speed.
MEDIUM: Recommended for most environments. Good combination of compression ratios and speed.
LOW: Least effect on backup throughput.
Better backup compression ratios are achieved by consolidating the free space in each data block, and setting that free space to binary zeroes.

The OPTIMIZE FOR LOAD option controls pre-compression processing. By specifying the default, OPTIMIZE FOR LOAD TRUE, you ensure that RMAN optimizes CPU usage and avoids pre-compression block processing.

By specifying OPTIMIZE FOR LOAD FALSE, RMAN uses additional CPU resources to perform precompression block processing.

xiii) CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

By default it is disbaled. To specify when archived redo logs are eligible for deletion. This deletion policy applies to all archiving destinations, including the flash recovery area.

xiv) CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/oracle/DB11G/product/11.2.0/dbhome_1/dbs/snapcf_brij.f’; # default

Specifying the snapshot controlfile format (File name and location):
A snapshot control file is created by RMAN during the backup process that serves as a point-in-time copy of the database control file. This will ensure that that backups being taken is consistent to a given point in time.For example, if you add a datafile or tablespace to a database after the backup has started, (assuming an online backup and before the backup has ended), that datafile and/or tablespace will not be included in the backup. It is sometimes required that the location and name of the snapshot control file be changed from its default.

C) CONFIGURE RMAN ENVIRONMENT AS PER REQUIREMENTS

If you want, you can script an entire set of configuration changes and run it from within a run block. Alternatively, you may execute the configure command from the RMAN command prompt in order to change a single parameter at a time, as shown below.

For the present case we have below requirements to take care:

REQUIRMENT 1 – Backup complete database every night

You can create one RMAN script (example below) and run it through cronjobs (if using UNIX/LINUX) every night

You can create below script > /backups/scripts/dbrman_bkup.sh

#########################################
#! /bin/bash
rman target=/ catalog=rman/rman@rmandb << EOF
RUN
{
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
CROSSCHECK BACKUP;
DELETE NOPROMPT OBSOLETE;
}
EXIT;
EOF
#######################################

NOTE We have added RMAN command “DELETE NOPROMPT OBSOLETE;”, so every night after backup RMAN will search for OBSOLETE backups as per this retention policy and delete them.

You can add below crontab entry to run the rman backup every night at 23:00 :

#——————————————————————————

# Minute Hour Month Day Month Weekday Command
# 0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#——————————————————————————

############################################################
# Database RMAN Backup
############################################################
00 23 * * * /backups/scripts/dbrman_bkup.sh 1>/backups/scripts/dbrman.log 2>&1

REQUIRMENT 2 – Keep last two Backups only

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

REQUIRMENT 3 – Use Disk for keeping the backup pieces
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

*It is default*

REQUIRMENT 4 – Control File is to be automatically backed up every time a back up is taken

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

REQUIRMENT 5 – Control file backups are to be stored on disk in the /backups/brij directory

RMAN> configure controlfile autobackup format for device type disk to ‘/backups/brij/controlfile_brij_%F’;

REQUIRMENT 6 – backups should be made using backup sets

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

*It is default*

REQUIRMENT 7 – backups should be stored on disk in the /backups/brij directory

RMAN> configure channel device type disk format ‘/backups/brij/ora_df%t_s%s_s%p’;

In the format specification:

%t stands for four-byte time stamp.
%s stands for the backup set number.
%p stands for the backup piece number.

Now all RMAN backups will be made in the /backups/brij directory, even if you’ve configured a flash recovery area and there is plenty of free space in it.

REQUIRMENT 8 – Each backup set  piece size should be 2GB or smaller

RMAN>CONFIGURE CHANNEL DEVICE TYPE disk MAXPIECESIZE 2G

REQUIRMENT 9 – backups should be in compressed format in order to save storage space

RMAN> configure device type disk PARALLELISM 1 backup type to compressed backupset;

 

D) CHECK THE CHANGED CONFIGURATION

Run ‘Show All’ command again to check the changed RMAN configuration.

RMAN> show all;

RMAN configuration parameters for database with db_unique_name BRIJ are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
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 ‘/backups/brij/controlfile_brij_%F’;
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
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 MAXPIECESIZE 2 G;
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128′; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/oracle/DB11G/product/11.2.0/dbhome_1/dbs/snapcf_brij.f’; # default

NOTE: If you want to clear any of the given configuration, use the configure command with the clear option:

Example:

RMAN> configure controlfile autobackup clear;
RMAN> configure snapshot controlfile name clear;
RMAN> configure backup optimization clear;
RMAN> configure retention policy clear;

 

 

 

Brijesh Gogia
Leave a Reply