RMAN is the preferred method used for backup and recovery of Oracle database. This article gives a brief overview of commands used to Configure, Display Configurations, Reset to Default, and take simple backups.
- The SHOW command gives current settings for RMAN utility to the associate target database.
- The CLEAR command resets to RMAN defaults.
- The following command allows for three backup copies of all data files and control files. the forth oldest will be considered obsolete and deleted. default is 1.
- RMAN> configure retention policy to redundancy 3;
- The following ensures that backup window of recovery is at least 7 days in the past, backups will be kept to allow for this regardless of redundancy policy.
- RMAN> configure retention policy to recovery window of 7 days;
- The following changes the default device type to tape, the default is disk.
- RMAN> configure default device type to sbt;
- Regardless of default device type, you can perform backup to specific backup with ‘device type’ clause.
- RMAN> backup device type sbt database;
- RMAN> backup device type disk database;
- RMAN can backup as an image copy or backup set.
- RMAN> configure device type disk backup type to backupset;
- RMAN> configure device type disk backup type to copy;
- TAPE backups can only be backup sets.
- binary compression can be used with backupsets with COMPRESSED option.
- RMAN> configure device type disk backup type to compressed backupset;
- RMAN> configure device type sbt backup type to compressed backupset;
- An RMAN channel is a connection to db server process, use the configure channel command to create and change channel settings.
- RMAN> configure channel device type disk maxpiecesize 1g;
- RMAN> configure channel device type disk format /tmp/%U;
- By default RMAN allocates a single disk channel for all operations, you can specify a distinct file name for a channel, but RMAN does not create a backup in the fast recovery area.
- RMAN> configure channel device type disk format ‘/u01/oradata/orcl_df%t_s%s_s%p’;
- RMAN> configure channel device type disk format ‘+dgroup1’;
- You can perform parallel backups by defining multiple channels for use.
- RMAN> RUN
- {
- allocate channel u01 device type disk format ‘/u01/%u’;
- allocate channel u02 device type disk format ‘/u02/%u’;
- backup database plus archivelog;
- }
- RMAN can be configured to autobackup control files and if in archivelog mode and a change occurs to controlfiles, they will be automatically backed up.
- RMAN> configure controlfile autobackup on;
- RMAN> configure controlfile autobackup off;
- RMAN configuration can be reset to default values by using the CLEAR option.
- RMAN> configure default device type clear;
- RMAN> configure retention policy clear;
- RMAN> configure controlfile autobackup clear;
- When RMAN optimization is enabled, it will skip files that have not changed since the last backup set. RMAN determines this by:
- Datafile must have same DBID, checkpoint SCN, creation SCN, resetlogs scn and time as one already in backup set.
- Datafile must be offline, read-only or closed.
- Archived log – must have same DBID, thread, sequence number, resetlogs scn and time.
- Backup Set – must have the same DBID, backup set record id, and stamp.
- RMAN will still take a backup of retention policy requires and if TO DESTINATION is used with BACKUP RECOVERY AREA or BACKUP RECOVERY FILES.
- Turn RMAN optimization on and off with:
- RMAN> configure backup optimization on;
- Once optimization is enabled, backup will not be performed, if nothing has changed since the last valid backup.
- Backup optimization can be overridden by the FORCE option.
- RMAN> backup database force;
- RMAN> backup archivelog all force;
Larry Catt
OCP