Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Part Number B14191-01 |
|
|
View PDF |
In RMAN, there are two ways to make multiple, identical copies of backups:
Duplex your backups within the BACKUP
AS
BACKUPSET
command, in which case RMAN creates more than one copy of each backup set
Back up your files as backup sets or image copies, and then back up the backup sets or image copies using the RMAN BACKUP
BACKUPSET
or BACKUP
COPY
commands.
When backing up datafiles, archived redo log files, server parameter files and control files into backup pieces, RMAN can duplex the backup set, producing up to four identical copies of each backup piece in the backup set on different backup destinations with one BACKUP
command. (Note that duplexing is not supported for backup operations that produce image copies.)
There are three ways to specify duplexing of backup sets when using the BACKUP
command:
Specify a default level of duplexing with CONFIGURE... BACKUP COPIES
All backup commands that back up data into backup sets will be affected if you use this option, unless you specify different duplexing options for a command using SET BACKUP COPIES
or provide a COPIES
option for the BACKUP
command.
Use SET BACKUP COPIES
in a RUN
block
All commands in the RUN
block will be affected, overriding any CONFIGURE
... BACKUP
COPIES
setting, except those where you provide a COPIES
option as part of the BACKUP
command.
Provide a COPIES
option to the BACKUP
command
For this specific BACKUP
command, files will be duplexed to produce the number of copies you specify.
The FORMAT
option of the BACKUP
command specifies the destinations to be used when performing duplexed backups. You can specify up to 4 values for the FORMAT
option. RMAN uses the second, third, and fourth values only when BACKUP
COPIES
, SET
BACKUP
COPIES
, or CONFIGURE
...
BACKUP
COPIES
is specified. The following example creates 3 copies of the backup of datafile 7
:
BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7 FORMAT '/tmp/%U','?/oradata/%U','?/%U';
RMAN places the first copy of each backup piece in /tmp
, the second in ?/oradata
, and the third in the Oracle home. Note that RMAN does not produce 3 backup sets, each with a different unique backup set key. Rather, RMAN produces one backup set with a unique key, and generates 3 identical copies of each backup piece in the set, as shown in this sample LIST
output:
List of Backup Sets =================== BS Key Type LV Size ------- ---- -- ---------- 1 Full 64K List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 7 Full 98410 08-FEB-03 /oracle/oradata/trgt/tools01.dbf Backup Set Copy #1 of backup set 1 Device Type Elapsed Time Completion Time Tag ----------- ------------ --------------- --- DISK 00:00:01 08-FEB-03 TAG20030208T152314 List of Backup Pieces for backup set 1 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 1 1 AVAILABLE /tmp/01dg9tb2_1_1 Backup Set Copy #2 of backup set 1 Device Type Elapsed Time Completion Time Tag ----------- ------------ --------------- --- DISK 00:00:01 08-FEB-03 TAG20030208T152314 List of Backup Pieces for backup set 1 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 2 1 AVAILABLE /oracle/oradata/01dg9tb2_1_2 Backup Set Copy #3 of backup set 1 Device Type Elapsed Time Completion Time Tag ----------- ------------ --------------- --- DISK 00:00:01 08-FEB-03 TAG20030208T152314 List of Backup Pieces for backup set 1 Copy #3 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 3 1 AVAILABLE /oracle/01dg9tb2_1_3
When choosing which FORMAT
value to use for each backup piece, RMAN uses the first format value for copy number 1, the second format value for copy number 2, and so forth. If the number of format values exceeds the number of copies, then the extra formats are not used. If the number of format values is less than the number of copies, then RMAN reuses the format values, starting with the first one.
See Also:
|
The RMAN BACKUP
BACKUPSET
command backs up previously created backup sets. Only backup sets that were created on device type DISK can be backed up using RMAN. They can be backed up to any available device type.
Note: RMAN issues an error if you attempt to runBACKUP AS COPY BACKUPSET . |
The BACKUP
BACKUPSET
command uses the default disk channel to copy backup sets from disk to disk. To back up from disk to tape, you must either configure or manually allocate a non-disk channel.
The BACKUP
BACKUPSET
command is a useful way to spread backups among multiple media. For example, you can execute the following BACKUP
command weekly as part of the production backup schedule:
# makes backup sets on disk BACKUP DEVICE TYPE DISK AS BACKUPSET DATABASE PLUS ARCHIVELOG; BACKUP DEVICE TYPE sbt BACKUPSET ALL; # copies backup sets on disk to tape
Note: Backups tosbt that use automatic channels require that you first run the CONFIGURE DEVICE TYPE sbt command. |
In this way, you ensure that all your backups exist on both disk and tape. You can also duplex backups of backup sets, as in this example:
BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL;
(Again, control file autobackups are never duplexed.)
You can also use BACKUP
BACKUPSET
to manage backup space allocation. For example, to keep more recent backups on disk and older backups only on tape, you can regularly run the following command:
BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE 'SYSDATE-7' DELETE INPUT;
This command backs up backup sets that were created more than a week ago from disk to tape, and then deletes them from disk. Note that DELETE
INPUT
here is equivalent to DELETE
ALL
INPUT
;RMAN deletes all existing copies of the backup set. If you duplexed a backup to four locations, then RMAN deletes all four copies of the pieces in the backup set.
If backup optimization is enabled when you issue the command to back up a backup set, and if the identical backup set has already been backed up to the same device type, then RMAN skips the backup of this backup set. For example, when backup optimization is turned on, the following command backs up to tape only those backup sets not already backed up on device type sbt
:
BACKUP DEVICE TYPE sbt BACKUPSET ALL;
When backing up backup sets, if RMAN discovers that one copy of a backup set is corrupted or missing, then it searches for other copies of the same backup set, based on the RMAN repository records about the backup set. This behavior is similar to the behavior of RMAN when backing up archived redo logs that exist in multiple archiving destinations.
For example, assume that backup set with key 872 contains three backup pieces, and that BACKUP
COPIES
3
was issued so that three copies of each backup piece were created, each on a different file system. Also assume that some copies have been deleted or corrupted, so that the following table describes the current status of the backup copies:
Backup Piece Number | Copy Number of the Piece | Status of Copy |
---|---|---|
1 | 1 | Corrupted |
1 | 2 | Intact |
1 | 3 | Corrupted |
2 | 1 | Missing |
2 | 2 | Corrupted |
2 | 3 | Intact |
3 | 1 | Intact |
3 | 2 | Corrupted |
3 | 3 | Missing |
The following command will cause RMAN to perform automatic failover:
BACKUP BACKUPSET 872;
RMAN copies only the backup pieces listed as "Intact" in the preceding table in its backup set.
You can use the following commands to back up existing image copies of database files either as backup sets or as image copies:
BACKUP
AS COPY
COPY
OF
DATABASE
BACKUP AS BACKUPSET
COPY
OF
TABLESPACE
tablespace_name
BACKUP AS BACKUPSET
COPY
OF
DATAFILE
datafile
When using these commands, there must already exist an image copy of every datafile specified in the command. If there are multiple copies of a datafile, the latest one is used. If you specify a tablespace or the whole database, RMAN issues an error if there are any datafiles in the database or tablespace specified for which there are no image copy backups in the RMAN repository.