RMAN has the ability to write duplexed backup sets creating up to four identical copies of each backup piece in a backup set to different destinations. Duplexing provides an extra layer of protection against disaster, media damage and human error that is easy to configure.
RMAN can duplex backup to either disk or tape but cannot duplex to disk and tape at the same time. Backup duplexing is not applicable to image copy backups.
This document will detail the steps to enable backup duplexing. The examples were performed on an Oracle Enterprise Linux system using Oracle 11gR2. The commands and examples will equally apply to 10gR2 and other host operating systems.
Using RMAN connect to the database and issue a show all
to see the current RMAN configuration.
[oracle@ora1 ~]$ rman Recovery Manager: Release 11.2.0.1.0 - Production on Wed Aug 25 12:29:16 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. RMAN> connect target / connected to target database: ORCL (DBID=1239150297) RMAN> show all; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name ORCL are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; CONFIGURE BACKUP OPTIMIZATION OFF; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/app/oracle/oradata/orcl/backup/%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO 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 FORMAT '/u03/app/oracle/oradata/orcl/backup/%U' MAXPIECESIZE 2 G; 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 BACKED UP 1 TIMES TO 'SBT_TAPE'; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default RMAN>
Here we see that the current configuration is for disk based backups using backup sets. Notice that currently the data file and archive log backup copies are set to 1.
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
The CONFIGURE BACKUP COPIES
command specifies how many copies to of each backup piece to make. Below are the configure commands to change the number of copies to 2.
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2; new RMAN configuration parameters: CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2; new RMAN configuration parameters: CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2; new RMAN configuration parameters are successfully stored RMAN>
You might be wondering where the CONFIGURE line is for duplexing the control file auto backup. The control file auto backup is not able to be duplexed.
It does not make sense to write both copies to the same location. Currently backups are written to the location specified by the CHANEL DEVICE TYPE DISK FORMAT
.
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oracle/oradata/orcl/backup/%U' MAXPIECESIZE 2 G;
You can specify another location by adding the new location after the first such as in the example below.
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oracle/oradata/orcl/backup/%U', '/u03/app/oracle/oradata/orcl/backup2/%U' MAXPIECESIZE 2 G; old RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oracle/oradata/orcl/backup/%U' MAXPIECESIZE 2 G; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oracle/oradata/orcl/backup/%U', '/u03/app/oracle/oradata/orcl/backup2/%U' MAXPIECESIZE 2 G; new RMAN configuration parameters are successfully stored RMAN>
Now that all of the necessary configuration changes have been made we can test out the duplexing of the backup.
RMAN> backup database plus archivelog delete input; Starting backup at 25-AUG-10 current log archived allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=41 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=32 device type=DISK channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=17 RECID=58 STAMP=727949834 channel ORA_DISK_1: starting piece 1 at 25-AUG-10 channel ORA_DISK_2: starting archived log backup set channel ORA_DISK_2: specifying archived log(s) in backup set input archived log thread=1 sequence=18 RECID=59 STAMP=727966740 channel ORA_DISK_2: starting piece 1 at 25-AUG-10 channel ORA_DISK_2: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T125901 piece handle=/u03/app/oracle/oradata/orcl/backup/33lm7p0l_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/33lm7p0l_1_2 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:15 channel ORA_DISK_2: deleting archived log(s) archived log file name=/u02/app/oracle/oradata/orcl/arch/1_18_717335393.dbf RECID=59 STAMP=727966740 channel ORA_DISK_1: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T125901 piece handle=/u03/app/oracle/oradata/orcl/backup/32lm7p0l_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/32lm7p0l_1_2 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:28 channel ORA_DISK_1: deleting archived log(s) archived log file name=/u02/app/oracle/oradata/orcl/arch/1_17_717335393.dbf RECID=58 STAMP=727949834 Finished backup at 25-AUG-10 Starting backup at 25-AUG-10 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u02/app/oracle/oradata/orcl/system01.dbf input datafile file number=00007 name=/u03/app/oracle/oradata/orcl/dbfs01.dbf input datafile file number=00002 name=/u02/app/oracle/oradata/orcl/sysaux01.dbf channel ORA_DISK_1: starting piece 1 at 25-AUG-10 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00003 name=/u02/app/oracle/oradata/orcl/undotbs01.dbf input datafile file number=00005 name=/u02/app/oracle/oradata/orcl/example01.dbf input datafile file number=00006 name=/u02/app/oracle/oradata/orcl/test.dbf channel ORA_DISK_2: starting piece 1 at 25-AUG-10 channel ORA_DISK_2: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T125929 piece handle=/u03/app/oracle/oradata/orcl/backup/35lm7p1h_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/35lm7p1h_1_2 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00004 name=/u02/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_2: starting piece 1 at 25-AUG-10 channel ORA_DISK_2: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T125929 piece handle=/u03/app/oracle/oradata/orcl/backup/36lm7p2l_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/36lm7p2l_1_2 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25 channel ORA_DISK_1: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T125929 piece handle=/u03/app/oracle/oradata/orcl/backup/34lm7p1h_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/34lm7p1h_1_2 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:03:41 Finished backup at 25-AUG-10 Starting backup at 25-AUG-10 current log archived using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=19 RECID=60 STAMP=727966991 channel ORA_DISK_1: starting piece 1 at 25-AUG-10 channel ORA_DISK_1: finished piece 1 at 25-AUG-10 with 2 copies and tag TAG20100825T130311 piece handle=/u03/app/oracle/oradata/orcl/backup/37lm7p8f_1_1 comment=NONE piece handle=/u03/app/oracle/oradata/orcl/backup2/37lm7p8f_1_2 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 channel ORA_DISK_1: deleting archived log(s) archived log file name=/u02/app/oracle/oradata/orcl/arch/1_19_717335393.dbf RECID=60 STAMP=727966991 Finished backup at 25-AUG-10 Starting Control File and SPFILE Autobackup at 25-AUG-10 piece handle=/u03/app/oracle/oradata/orcl/backup/c-1239150297-20100825-01 comment=NONE Finished Control File and SPFILE Autobackup at 25-AUG-10 RMAN>
Notice that while each backup piece is written to different locations each has the same name. Duplexing occurred on both the archive log backup and the data file backup as configured.
hi!!!
Sir,
What about the controlfile autobackups?
Need to find a way to have autobackups at two different locations.
Please advice.