Oracle's Recovery Manager (RMAN) utility is used to backup and recover data from Oracle databases. There are several steps involved in setting up RMAN, which are as follows:
Setting up the RMAN environment: You must ensure that the Oracle database is operational before configuring RMAN. You can start the RMAN utility and set up the RMAN environment once the database is up. Configuring the RMAN channels for backups and setting the ORACLE_HOME and ORACLE_SID environment variables are required for this.
How to set up the RMAN repository: RMAN requires a vault to store reinforcement metadata. This store can be found either in the data set or in a different list data set. The RMAN catalog command is used to configure the repository.
Setting up retention policies for backups: RMAN permits you to set maintenance approaches for reinforcements, which decides how long reinforcements are held before they are erased. The RMAN retention command is used to set retention policies.
Setting up schedules for backups: You can set up RMAN to run backups automatically at predetermined intervals. The RMAN backup command is used to set up backup schedules.
Designing reinforcement pressure: Backups can be compressed with RMAN to save disk space. The RMAN compression command can be used to set backup compression.
Setting up encryption for backups: RMAN permits you to scramble reinforcements for added security. The RMAN encryption command can be used to set up backup encryption.
Trying out backups: It is essential to test backups following RMAN configuration to ensure that they can be successfully restored in the event of a database failure. The RMAN restore command can be used to test backups.
Setup of the RMAN environment, configuration of the RMAN repository, backup retention policies, backup schedules, compression, and encryption, and testing of backups to ensure that they can be successfully restored are all part of RMAN configuration.
Implementation:
$ rman target /
- CONFIGURE BACKUP OPTIMIZATION ON;
Configuring a Retention Policy: Example
This example configures a retention policy with a recovery window of 2 weeks, and then resets the retention policy to its default value of REDUNDANCY = 1:
- CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
- CONFIGURE RETENTION POLICY CLEAR;
Configuring Automatic Disk and Tape Channels: Example
This example configures generic DISK and sbt channels, sets the default device type to sbt, and sets PARALLELISM to 3:
- CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/?/%U';
- CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(NSR_SERVER=bksrv1)';
- CONFIGURE DEFAULT DEVICE TYPE TO sbt;
- CONFIGURE DEVICE TYPE sbt PARALLELISM 3;
Overriding the Default Device Type: Example
This example configures the default device type to sbt, backs up the archived logs on the default sbt channel, and then backs up the database to disk on the default disk channel:
- CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(NSR_SERVER=bksrv1)';
- CONFIGURE DEFAULT DEVICE TYPE TO sbt;
- BACKUP ARCHIVELOG ALL;
- BACKUP DEVICE TYPE DISK DATABASE;
Configuring Automatic Channels Across File Systems: Example
This example configures automatic disk channels across three file systems:
- CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
- CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/backup/%U';
- CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/backup/%U';
- CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/disk3/backup/%U';
- BACKUP DEVICE TYPE DISK DATABASE PLUS ARCHIVELOG;
Configuring Automatic Channels in an Oracle Real Application Clusters Configuration: Example
This example allocates automatic sbt channels for two nodes of an Oracle Real Application Clusters database:
- CONFIGURE DEVICE TYPE sbt PARALLELISM 2;
- CONFIGURE DEFAULT DEVICE TYPE TO sbt;
- CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT 'SYS/change_on_install@node1'
PARMS 'ENV=(NSR_SERVER=bkserv1)';
- CONFIGURE CHANNEL 2 DEVICE TYPE sbt CONNECT 'SYS/change_on_install@node2'
PARMS ENV=(NSR_SERVER=bkserv2)';
Clearing Automatic Channels: Example
This example clears manually numbered DISK channels 2 and 3 and the generic sbt channel:
- CONFIGURE CHANNEL 2 DEVICE TYPE DISK CLEAR;
- CONFIGURE CHANNEL 3 DEVICE TYPE DISK CLEAR;
- CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;
Configuring and Clearing Parallelism: Example
This example sets DISK parallelism to 2, then changes it to 3, then returns it to the default parallelism of 1:
- CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
- CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
- CONFIGURE DEVICE TYPE DISK CLEAR;
Configuring Backup Copies: Example
This example configures duplexing to 3 for DISK backups of datafiles and control files (control file autobackups on disk are a special case and are never duplexed) and then runs a database backup, specifying three different file systems for the copies:
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3;
- BACKUP DEVICE TYPE DISK DATABASE
FORMAT '/disk1/backup/%U', '/disk2/backup/%U', '/disk3/backup/%U';
Configuring the Snapshot Control File Location: Example
This example configures a new location for the snapshot control file and then resynchronizes the recovery catalog.
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '?/oradata/snap.cf';
Excluding a Tablespace from a Whole Database Backup: Example
This example excludes the example tablespace from whole database backups, then returns the tablespace to its default value of "not excluded":
- CONFIGURE EXCLUDE FOR TABLESPACE example;
- CONFIGURE EXCLUDE CLEAR;
Specifying Auxiliary Filenames: Example
This example duplicates a database to a remote host with a different directory structure, by using CONFIGURE AUXNAME to specify new filenames for the datafiles:
# set auxiliary names for the datafiles
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oracle/auxfiles/aux_2.f';
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oracle/auxfiles/aux_3.f';
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oracle/auxfiles/aux_4.f';
RUN
{
ALLOCATE AUXILIARY CHANNEL dupdb1 TYPE DISK;
DUPLICATE TARGET DATABASE TO dupdb
LOGFILE
GROUP 1 ('?/dbs/dupdb_log_1_1.f',
'?/dbs/dupdb_log_1_2.f') SIZE 200K,
GROUP 2 ('?/dbs/dupdb_log_2_1.f',
'?/dbs/dupdb_log_2_2.f') SIZE 200K REUSE;
}
# Un-specify the auxiliary names for the datafiles so that they are not overwritten
# by mistake:
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 3 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR;
Specifying the Default Format for the Control File Autobackup: Example
This example turns on the autobackup feature, then changes the default format for the DISK and sbt devices, then clears the autobackup setting:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO 'cf_auto_%F';
CONFIGURE CONTROLFILE AUTOBACKUP CLEAR; # returns to default setting of OFF