2.2. Backup Sets and Image Copies

Let's go into more detail about backup sets and how to use them. Database files in backup sets are stored in a special RMAN format and must be processed with the RESTORE command before these files are usable. This can take more time and effort during the recovery process. In the following sections, you will look at an example of using the BACKUP command and the BACKUP AS COPY or the deprecated COPY command. While the COPY command is still supported in Oracle 10g, this command has been replaced with BACKUP AS COPY. The COPY command may not be supported in future releases of Oracle Database.

2.2.1. Creating Backup Sets

The RMAN BACKUP command is used to perform the backup set backup process. The backup set backup process consists of using the BACKUP command instead of the COPY or BACKUP AS COPY command. This section contains an example of the BACKUP command.

In this example, you are backing up the database ora101t and storing in two backup sets: FULL DATAFILE BACKUPSET and ARCHIVE LOG BACKUP SET. FULL DATAFILE BACKUPSET is made up of two backup pieces. ARCHIVE LOG BACKUPSET is comprised on one backup piece. The backup piece is the actual file within the backup set. The backup set is a logical grouping of backup pieces that is stored in a proprietary format.

The first backup piece has the majority of the datafiles. This is called DB_04FODN6N_ORA101T_4. The second backup piece has the control file. This backup set is called DB_05FODNAC_ORA101T_5. The last backup piece has all of the archive logs and is called LOG_T528932180_S6_P1. All of these are stored in the C:WINDOWSSystem32 directory by default.

C:Documents and Settings>rman
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2004, Oracle. All rights reserved.

RMAN> connect target

connected to target database: ORA101T (DBID=2615281366)

RMAN> run

{
allocate channel c1 type disk;
backup database format 'db_%u_%d_%s';
backup format 'log_t%t_s%s_p%p'
(archivelog all);
}

allocated channel: c1
channel c1: sid=49 devtype=DISK

Starting backup at 15-JUN-04
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101TSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101TSYSAUX01.DBF
input datafile fno=00005 name=C:ORACLEORADATAORA101TEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101TUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101TUSERS01.DBF
channel c1: starting piece 1 at 15-JUN-04
channel c1: finished piece 1 at 15-JUN-04
piece handle=C:WINDOWSSYSTEM32DB_04FODN6N_ORA101T_4 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:57
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
including current controlfile in backupset
channel c1: starting piece 1 at 15-JUN-04
channel c1: finished piece 1 at 15-JUN-04
piece handle=C:WINDOWSSYSTEM32DB_05FODNAC_ORA101T_5 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:05
Finished backup at 15-JUN-04

Starting backup at 15-JUN-04
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=1 stamp=527413772
input archive log thread=1 sequence=8 recid=2 stamp=527414322
input archive log thread=1 sequence=9 recid=3 stamp=528706062
channel c1: starting piece 1 at 15-JUN-04
channel c1: finished piece 1 at 15-JUN-04
piece handle=C:WINDOWSSYSTEM32LOG_T528932180_S6_P1 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:09 Finished backup at 15-JUN-04
released channel: c1

RMAN>

Backup sets have an inherent performance capability called multiplexing. Multiplexing the files in a backup set is when multiple files get read and then each of the file blocks gets written to the same backup set. These blocks are interspersed together. Image copies cannot be multiplexed. Figure 2.1 displays the interspersing of three datafiles into one backup set.

Figure 2.1. Multiplexing backup sets

2.2.2. Creating Image Copies

Let's go into some detail about image copies and how they function. Image copies are actual copies of the database files, archive logs, or control files and are not stored in a special RMAN format. Image copies can be stored only on disk.

An image copy in RMAN is equivalent to an operating system copy command such as cp or dd in Unix, or COPY in Windows. Thus, no RMAN restore processing is necessary to make image copies usable in a recovery situation. This can improve the speed and efficiency of the restore and recovery process in most cases. However, there is also a price for this restore efficiency—the size of image copy backups. The image copy backup cannot be compressed and requires much more space than a backup set.

Let's look at an example of using the RMAN COPY command to create an image copy of various database files. This example shows the command necessary to perform an image copy.

In this example, you are backing up the system datafile and current control file as image copies to the C:oraclestagingora101t directory:

RMAN> run { allocate channel ch1 type disk;
copy
datafile 1 to 'C:oraclestagingora101tSYSTEM01.DBF' ,
current controlfile to 'C:oraclestagingora101tCONTROL01.ctl';}

allocated channel: ch1

channel ch1: sid=52 devtype=DISK
Starting backup at 16-JUN-04
channel ch1: starting datafile copy
input datafile fno=00001 name=C:ORACLEORADATAORA101TSYSTEM01.DBF
output filename=C:ORACLESTAGINGORA101TSYSTEM01.DBF tag=TAG20040616T233305 re
cid=7 stamp=529025661
channel ch1: datafile copy complete, elapsed time: 00:01:17
channel ch1: starting datafile copy
copying current controlfile
output filename=C:ORACLESTAGINGORA101TCONTROL01.CTL tag=TAG20040616T233305 r
ecid=8 stamp=529025663
channel ch1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 16-JUN-04
released channel: ch1
RMAN>

In Oracle 10g, there is a new backup command that simplifies image copies: BACKUP AS COPY. The benefit of this image copy is that you can perform image copies of an entire database, multiple tablespaces, datafiles, and archive logs without having to specify all of the individual files. In the previous image copy example, the location of the SYSTEM01.DBF file must be known before you do the copy. This requires a lot of extra work. Now you can just back up the whole database with one image copy command.

Let's take a look at how easily this new Oracle 10g command performs an image copy of an entire database. Let's use the TAG parameter to give this image copy a unique name:

C:Documents and Settingsdstuns>rman

Recovery Manager: Release 10.1.0.2.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

RMAN> connect target

connected to target database: ORA101T (DBID=2615281366)

RMAN> backup as copy tag "062504_backup" database;

Starting backup at 12-SEP-04
using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=50 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=C:ORACLEORADATAORA101TSYSTEM01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_SYS
TEM_0N8WXSTO_.DBF tag=062504_BACKUP recid=13 stamp=536663184
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=C:ORACLEORADATAORA101TSYSAUX01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_SYS
AUX_0N8X05CM_.DBF tag=062504_BACKUP recid=14 stamp=536663219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=C:ORACLEORADATAORA101TEXAMPLE01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_EXA
MPLE_0N8X18D8_.DBF tag=062504_BACKUP recid=15 stamp=536663243
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=C:ORACLEORADATAORA101TUNDOTBS01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_UND
OTBS1_0N8X21TT_.DBF tag=062504_BACKUP recid=16 stamp=536663253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=C:ORACLEORADATAORA101TINDEX01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_IND
EXES_0N8X29D5_.DBF tag=062504_BACKUP recid=17 stamp=536663260
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=C:ORACLEORADATAORA101TUSERS01.DBF
output filename=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TDATAFILEO1_MF_USE
RS_0N8X2JS0_.DBF tag=062504_BACKUP recid=18 stamp=536663265
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 12-SEP-04

Starting Control File Autobackup at 12-SEP-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TAUTOBACKUP2004_09_12
  O1_MF_N_536663267_0N8X2PJT_.BKP comment=NONE Finished Control File Autobackup at 12-SEP-04

RMAN>

2.2.3. Compressed Backups

New with Oracle 10g RMAN is the capability to compress backups. In previous versions, reducing the size of backups was performed by backing up only used blocks and skipping unused blocks. This had limited effectiveness because this would reduce only the backup sizes of datafiles that were oversized or had significant free space.

With 10g, you can now compress backups regardless of the contents of the datafiles. This allows real compression of backups. Compressed backups work only with backup sets, not image copies. This includes database, tablespace, and datafile backup sets.

In the next section, you will create a compressed backup set. You will also configure a compressed backup to use a default device. You will walk through each of these capabilities in detail.

NOTE

Image copies are exact copies of the Oracle database files. This means that the files do not compress as backup sets do. The files are stored in original format and not in the format of an RMAN backup set. Image copies cannot be compressed.

2.2.3.1. Creating Compressed Backup Sets for RMAN

Creating a compressed backup set is a fairly straightforward process. This is accomplished using the BACKUP AS COMPRESSED command. This functions as a normal backup set, but the backup set is compressed. Let's see how to create a compressed backup set:

RMAN> backup as compressed backupset database;

Starting backup at 17-JUN-04
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=34 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101TSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101TSYSAUX01.DBF
input datafile fno=00005 name=C:ORACLEORADATAORA101TEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101TUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101TUSERS01.DBF
channel ORA_DISK_1: starting piece 1 at 17-JUN-04
channel ORA_DISK_1: finished piece 1 at 17-JUN-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TBACKUPSET
  
2004_06_17O1_MF_NNNDF_TAG20040617T000017_0F2JD5H7_.BKP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:37 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset

including current controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 17-JUN-04
channel ORA_DISK_1: finished piece 1 at 17-JUN-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101TORA101TBACKUPSET
  
2004_06_17O1_MF_NCNNF_TAG20040617T000017_0F2JH5WY_.BKP comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:09 Finished backup at 17-JUN-04 RMAN>

A default device can be configured for compressed backups. This is activated by using the CONFIGURE command. When this command is executed, all backups using a designated device will be compressed until the configuration is modified. Let's look at this command for configuring a default device to use compressed backups:

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

old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET
  PARALLELISM 1;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
starting full resync of recovery catalog
full resync complete

RMAN>

Next, let's look at the resulting backup set sizes to verify that these backup sets are compressed. Look first at the standard backup set file for the database ora101t DB_01FODMV3_ORA101T_1.BKP. Next, compare it to the compressed backup set file NNNDF_TAG20040617T000017.BKP. Here is an example:

C:WINDOWSSystem32>dir *.BKP
06/15/2004 09:32 PM     548,052,992 DB_01FODMV3_ORA101T_1.BKP
06/17/2004 12:01 AM     109,101,056 NNNDF_TAG20040617T000017.BKP

As you can see, the compressed backup NNNDF_TAG20040617T000017.BKP is one-fifth the size of the non-compressed backup DB_01FODMV3_ORA101T_1.BKP.

NOTE

Compressed database backup sets are compressed at approximately a 5-to-1 ratio, or 20 percent of the size of a standard backup set.

2.2.4. Full and Incremental Backups

The full and incremental backups are differentiated by how the data blocks are backed up in the target database. The full backup backs up all the data blocks in the datafiles, modified or not. An incremental backup backs up only the data blocks in the datafiles that were modified since the last incremental backup.

The full backup cannot be used as part of an incremental backup strategy. The baseline backup for an incremental backup is a level 0 backup. A level 0 backup is a full backup at that point in time. Thus, all blocks—modified or not—are backed up, allowing the level 0 backup to serve as a baseline for future incremental backups. The incremental backups can then be applied with the baseline—level 0—backup to form a full backup at some time in the future. The benefit of the incremental backup is that it is quicker, because not all data blocks need to be backed up.

NOTE

Oracle incremental backups are designated as level 0 and level 1. A level 0 backup includes every block in the file except blocks that have never been used. A level 1 backup includes only those blocks that have been changed since the parent backup was taken. A level 0 backup is essentially a full backup, except a level 0 backup can be used as a parent to a level 1 backup.

There are two types of incremental backups: differential and cumulative. Both the differential and cumulative backups back up only modified blocks. The difference between these two types of incremental backups is in what the baseline database uses to identify the modified blocks that need to be backed up.

The differential incremental backup backs up only data blocks modified since the most recent backup at the same level or lower. A differential incremental backup determines which level 1 or level 2 backup has occurred most recently and backs up only blocks that have changed since that backup. The differential incremental backup is the default incremental backup.

The cumulative incremental backup backs up only the data blocks that have changed since the most recent backup of the next lowest level, or n −1 or lower (with n being the existing level of backup). For example, if you are performing a level 2 cumulative incremental backup, the backup will copy data blocks only from the most recent level 1 backup. If no level 1 backup is available, then it will back up all data blocks that have changed since the most recent level 0 backup. This means that only one cumulative incremental backup needs to be restored instead of multiple differential incremental backups.

Full backups do not mean the complete database was backed up. In other words, a full backup can back up only part of the database and not all datafiles, control files, and logs.


Let's perform these two types of incremental backups: a differential incremental and a cumulative incremental backup.

2.2.4.1. Performing a Differential Incremental Backup

As stated in the preceding section, a differential incremental backup only backs up data blocks modified since the most recent backup at the same level or lower. The first incremental backup must be a level 0 backup that contains all used blocks. Next, you can perform a level 1 backup, which will pick up the changed blocks. Let's walk through the differential incremental backup:

RMAN> backup incremental level 0 database;

Starting backup at 25-JUL-04
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=139 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF
input datafile fno=00005 name=C:ORACLEORADATAORA101CEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101CUSERS01.DBF
channel ORA_DISK_1: starting piece 1 at 25-JUL-04
channel ORA_DISK_1: finished piece 1 at 25-JUL-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_34_1.BAK
  
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:02:16 channel ORA_DISK_1: starting incremental level 0 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current controlfile in backupset channel ORA_DISK_1: starting piece 1 at 25-JUL-04 channel ORA_DISK_1: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_35_1.BAK
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:09 Finished backup at 25-JUL-04 RMAN>

Next, let's see a level 1 incremental backup after some data has been changed in the database. The incremental level 1 backup will pick up the changes since the level 0 backup. Let's perform a level 1 incremental differential backup:

RMAN> backup incremental level 1 database;

Starting backup at 25-JUL-04

using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF
input datafile fno=00005 name=C:ORACLEORADATAORA101CEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101CUSERS01.DBF
channel ORA_DISK_1: starting piece 1 at 25-JUL-04
channel ORA_DISK_1: finished piece 1 at 25-JUL-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_36_1.BAK
  
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:57 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current controlfile in backupset channel ORA_DISK_1: starting piece 1 at 25-JUL-04 channel ORA_DISK_1: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_37_1.BAK
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05 Finished backup at 25-JUL-04 RMAN>

2.2.4.2. Performing a Cumulative Incremental Backup

A cumulative incremental backup is different from the differential incremental backup in that it requires more space. The benefit of this is that cumulative incremental backups are usually faster and easier to restore because only one backup for a given level is needed to restore. A differential incremental backup compares between level 0 and level 1 and determines which one has most recently occurred to make the baseline comparison. Let's see a cumulative incremental backup:

RMAN> backup incremental level 1 cumulative database;

Starting backup at 25-JUL-04
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF
input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF

input datafile fno=00005 name=C:ORACLEORADATAORA101CEXAMPLE01.DBF
input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF
input datafile fno=00004 name=C:ORACLEORADATAORA101CUSERS01.DBF
channel ORA_DISK_1: starting piece 1 at 25-JUL-04
channel ORA_DISK_1: finished piece 1 at 25-JUL-04
piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_38_1.BAK
  
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:57 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current controlfile in backupset channel ORA_DISK_1: starting piece 1 at 25-JUL-04 channel ORA_DISK_1: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_39_1.BAK
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 25-JUL-04 RMAN>

As you can see, performing a cumulative incremental backup is almost the same as running a differential incremental backup. The difference is all in how the backup is stored. As stated earlier, the cumulative incremental backup stores more complete information, which takes up more space. However, this negative aspect is compensated by the fact that recovery operations are more efficient.

2.2.5. Parallelization of Backup Sets

Parallelization of backup sets is performed by causing multiple backup sets to be concurrently backed up over multiple device channels. This is done by allocating multiple channels, one for each backup set that needs to be concurrently backed up before the backup process occurs. You can either modify the CONFIGURE settings for channel parallelism greater than 1 or use manual channel allocation.

Let's walk through an example of manually backing up in parallel:

  1. Select the target database and start RMAN:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:Documents and Settingsdstuns>set ORACLE_SID=ora101c
    
    C:Documents and Settingsdstuns>rman

    Recovery Manager: Release 10.1.0.2.0 - Production
    
    Copyright (c) 1995, 2004, Oracle. All rights reserved.
    
    RMAN>

  2. Start the BACKUP command in the backup script and allocate two channels: c1 and c2. Then specify datafile backups to c1 and archive logs to c2. This also backs up the control file:

    RMAN> run
    2> {
    3> allocate channel c1 type disk;
    4> allocate channel c2 type disk;
    5> backup
    6> (datafile 1,2,3 channel c1)
    7> (archivelog all channel c2);
    8> }
    
    allocated channel: c1
    channel c1: sid=137 devtype=DISK
    
    allocated channel: c2
    channel c2: sid=136 devtype=DISK
    
    Starting backup at 25-JUL-04
    channel c1: starting full datafile backupset
    channel c1: specifying datafile(s) in backupset
    input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF
    input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF
    input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF
    channel c1: starting piece 1 at 25-JUL-04
    channel c2: starting archive log backupset
    channel c2: specifying archive log(s) in backup set
    input archive log thread=1 sequence=63 recid=58 stamp=531002016
    input archive log thread=1 sequence=64 recid=59 stamp=531162548
    input archive log thread=1 sequence=65 recid=60 stamp=531162638
    input archive log thread=1 sequence=66 recid=61 stamp=531306751
    input archive log thread=1 sequence=67 recid=62 stamp=531321226
    input archive log thread=1 sequence=68 recid=63 stamp=531342067
    input archive log thread=1 sequence=69 recid=64 stamp=531356435
    input archive log thread=1 sequence=70 recid=65 stamp=531363656
    input archive log thread=1 sequence=71 recid=66 stamp=531381614

    input archive log thread=1 sequence=72 recid=67 stamp=531399627
    input archive log thread=1 sequence=73 recid=68 stamp=531417474
    input archive log thread=1 sequence=74 recid=69 stamp=531474062
    input archive log thread=1 sequence=75 recid=70 stamp=531475253
    input archive log thread=1 sequence=76 recid=71 stamp=531496839
    input archive log thread=1 sequence=77 recid=72 stamp=531514865
    input archive log thread=1 sequence=78 recid=73 stamp=531533230
    input archive log thread=1 sequence=79 recid=74 stamp=531551964
    input archive log thread=1 sequence=80 recid=75 stamp=531572450
    input archive log thread=1 sequence=81 recid=76 stamp=531590454
    input archive log thread=1 sequence=82 recid=77 stamp=531761112
    input archive log thread=1 sequence=83 recid=78 stamp=531761285
    input archive log thread=1 sequence=84 recid=79 stamp=531766863
    input archive log thread=1 sequence=85 recid=80 stamp=531784872
    input archive log thread=1 sequence=86 recid=81 stamp=531831653
    input archive log thread=1 sequence=87 recid=82 stamp=531849625
    input archive log thread=1 sequence=88 recid=83 stamp=532443308
    input archive log thread=1 sequence=89 recid=84 stamp=532445159
    input archive log thread=1 sequence=90 recid=85 stamp=532445168
    channel c2: starting piece 1 at 25-JUL-04
    channel c1: finished piece 1 at 25-JUL-04
    piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101CORA101CBACKUPSET
      
    2004_07_25 01_MF_NNNDF_TAG20040725T141518_0J88QHW9_.BKP comment=NONE channel c1: backup set complete, elapsed time: 00:02:53 channel c2: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101CORA101CBACKUPSET
    2004_07_25 01_MF_ANNNN_TAG20040725T141518_0J88RXTM_.BKP comment=NONE channel c2: backup set complete, elapsed time: 00:02:52 Finished backup at 25-JUL-04 Starting Control File Autobackup at 25-JUL-04 piece handle=C:ORACLESTAGINGORA101CCF_C-1736563848-20040725-00
    comment=NONE Finished Control File Autobackup at 25-JUL-04 released channel: c1 released channel: c2 RMAN>

The automated method of parallelizing your backup requires modifying the CONFIGURE setting of the parallelization parameter to the desired parallelization parameter. In the following example, you will use the parameter 3.

Let's walk through this example:

  1. After connecting to the target database and starting RMAN, display the configuration settings:

    RMAN> show all;
    
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
    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
      
    'c:oraclestagingora101ccf_%F'; 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 CHANNEL DEVICE TYPE DISK FORMAT '/oracle/flash_recovery_area/ora101c /%rec_area_%s_%p.bak'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:ORACLEPRODUCT10.1.0DB_1DATABASES NCFORA101C.ORA'; # default

  2. Next, set the PARALLELISM setting to the desired value, in this case, 3.

    RMAN>configure device type disk parallelism 3;
    
    new RMAN configuration parameters:
    CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
    new RMAN configuration parameters are successfully stored
    
    RMAN>

  3. Then, execute a BACKUP command. The backup actions will be divided among the number of channels specified in the PARALLELISM configuration setting.

    RMAN> backup
    2> (datafile 1,2)
    3> (datafile 3,4)
    4> (archivelog all);

    Starting backup at 25-JUL-04
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=137 devtype=DISK
    allocated channel: ORA_DISK_2
    channel ORA_DISK_2: sid=136 devtype=DISK
    allocated channel: ORA_DISK_3
    channel ORA_DISK_3: sid=135 devtype=DISK
    channel ORA_DISK_1: starting archive log backupset
    channel ORA_DISK_1: specifying archive log(s) in backup set
    input archive log thread=1 sequence=72 recid=67 stamp=531399627
    input archive log thread=1 sequence=73 recid=68 stamp=531417474
    input archive log thread=1 sequence=74 recid=69 stamp=531474062
    input archive log thread=1 sequence=75 recid=70 stamp=531475253
    input archive log thread=1 sequence=76 recid=71 stamp=531496839
    input archive log thread=1 sequence=77 recid=72 stamp=531514865
    input archive log thread=1 sequence=78 recid=73 stamp=531533230
    input archive log thread=1 sequence=79 recid=74 stamp=531551964
    input archive log thread=1 sequence=80 recid=75 stamp=531572450
    input archive log thread=1 sequence=81 recid=76 stamp=531590454
    channel ORA_DISK_1: starting piece 1 at 25-JUL-04
    channel ORA_DISK_2: starting archive log backupset
    channel ORA_DISK_2: specifying archive log(s) in backup set
    input archive log thread=1 sequence=63 recid=58 stamp=531002016
    input archive log thread=1 sequence=64 recid=59 stamp=531162548
    input archive log thread=1 sequence=65 recid=60 stamp=531162638
    input archive log thread=1 sequence=66 recid=61 stamp=531306751
    input archive log thread=1 sequence=67 recid=62 stamp=531321226
    input archive log thread=1 sequence=68 recid=63 stamp=531342067
    input archive log thread=1 sequence=69 recid=64 stamp=531356435
    input archive log thread=1 sequence=70 recid=65 stamp=531363656
    input archive log thread=1 sequence=71 recid=66 stamp=531381614
    channel ORA_DISK_2: starting piece 1 at 25-JUL-04
    channel ORA_DISK_3: starting archive log backupset
    channel ORA_DISK_3: specifying archive log(s) in backup set
    input archive log thread=1 sequence=82 recid=77 stamp=531761112
    input archive log thread=1 sequence=83 recid=78 stamp=531761285
    input archive log thread=1 sequence=84 recid=79 stamp=531766863
    input archive log thread=1 sequence=85 recid=80 stamp=531784872
    input archive log thread=1 sequence=86 recid=81 stamp=531831653

    input archive log thread=1 sequence=87 recid=82 stamp=531849625
    input archive log thread=1 sequence=88 recid=83 stamp=532443308
    input archive log thread=1 sequence=89 recid=84 stamp=532445159
    input archive log thread=1 sequence=90 recid=85 stamp=532445168
    channel ORA_DISK_3: starting piece 1 at 25-JUL-04
    channel ORA_DISK_1: finished piece 1 at 25-JUL-04
    piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_19_1.BAK
      
    comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:03 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=C:ORACLEORADATAORA101CSYSTEM01.DBF channel ORA_DISK_1: starting piece 1 at 25-JUL-04

    channel ORA_DISK_2: finished piece 1 at 25-JUL-04
    piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_20_1.BAK
      
    comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:01:04 channel ORA_DISK_2: starting full datafile backupset channel ORA_DISK_2: specifying datafile(s) in backupset input datafile fno=00003 name=C:ORACLEORADATAORA101CSYSAUX01.DBF channel ORA_DISK_2: starting piece 1 at 25-JUL-04 channel ORA_DISK_3: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_21_1.BAK
    comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:01:05 channel ORA_DISK_3: starting full datafile backupset channel ORA_DISK_3: specifying datafile(s) in backupset input datafile fno=00002 name=C:ORACLEORADATAORA101CUNDOTBS01.DBF channel ORA_DISK_3: starting piece 1 at 25-JUL-04 channel ORA_DISK_3: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_24_1.BAK
    comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:01:00 channel ORA_DISK_3: starting full datafile backupset channel ORA_DISK_3: specifying datafile(s) in backupset input datafile fno=00004 name=C:ORACLEORADATAORA101CUSERS01.DBF channel ORA_DISK_3: starting piece 1 at 25-JUL-04 channel ORA_DISK_2: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_23_1.BAK
    comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:01:18 channel ORA_DISK_3: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_25_1.BAK
    comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:00:29 channel ORA_DISK_1: finished piece 1 at 25-JUL-04 piece handle=C:ORACLEFLASH_RECOVERY_AREAORA101C\%REC_AREA_22_1.BAK
    comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:50 Finished backup at 25-JUL-04 Starting Control File Autobackup at 25-JUL-04 piece handle=C:ORACLESTAGINGORA101CCF_C-1736563848-20040725-01
    comment=NONE Finished Control File Autobackup at 25-JUL-04 RMAN>

2.2.6. Backup Options

RMAN provides many options for the backup process. These options control filenames, backup performance, and the size of backups.

Options that control filenames are handled with FORMAT and TAG parameters with the BACKUP command. The RATE option limits backup I/O bandwidth usage on a computer. This limits RMAN from consuming all of a server's resources during backup operations. The DURATION option determines the maximum time a backup can process before being terminated. When backups exceed the DURATION option, the backups stop and are marked unus-able. The last options impact the file sizes of backup sets and backup pieces. The options that control sizes are the MAXSETSIZE and MAXPIECESIZE. These options limit the size of backup sets and backup pieces.

Let's look at the options that control RMAN filenames, which are FORMAT and TAG options. The FORMAT option has many variables but the default format is %U. The default %U FORMAT variables are handled differently for the different types of files in an image copy. Table 2.2 lists some of the FORMAT options available.

Table 2.2. FORMAT options
OptionDescription
%aSpecifies the activation ID of the database
%cSpecifies the copy number of the backup piece within a set of duplexed backup pieces
%dSpecifies the name of the database
%DSpecifies the current day of the month from the Gregorian calendar
%eSpecifies the archived log sequence number
%fSpecifies the absolute file number
%FCombines the database ID (DBID), day, month, year, and sequence into a unique and repeatable generated name
%hSpecifies the archived redo log thread number
%ISpecifies the DBID
%MSpecifies the month in the Gregorian calendar in MM format
%NSpecifies the tablespace name
%nSpecifies the name of the database, padded on the right with n characters to a total length of eight characters
%pSpecifies the piece number within the backup set
%sSpecifies the backup set number
%tSpecifies the backup set timestamp
%TSpecifies the year, month, and day in the Gregorian calendar
%uSpecifies an eight-character name constituted by compressed representations of the backup set or image copy number
%USpecifies a system-generated unique filename (this is the default setting)

NOTE

The full set of FORMAT variables or specifications is described in Oracle Database Recovery Manager Reference 10g, Release 1 (10.1), part number B10770-02.

Let's look at examples of how to use the FORMAT option with backup sets and image copies:

RMAN> backup tablespace users format='user_bs_%d%p%s';


RMAN> backup as copy tablespace users format=
  
'C:oracleackupsoral01cusers_%d%p%s';

The TAG option is similar to the FORMAT option, but it is a user-specified string value. The TAG option can be used with image copies and backup sets. Let's look at an example of the TAG option:

RMAN> backup database tag weekly_backup;

The RATE option is designed to limit RMAN from using excessive system resources during backup and restore operations. The RATE option can be set with the CONFIGURE settings. Let's set the RATE option to read only 5MB per second:

RMAN> CONFIGURE CHANNEL DEVICE TYPE disk RATE 5M;

The MAXSETSIZE and MAXPIECESIZE parameters control the size of the backup sets and backup pieces. Setting the MAXSETSIZE parameter allows you to control the amount of files per backup set and can make RMAN create additional backup sets. This can have benefits in recovery options because you can recover multiple backup sets in parallel on different channels.

The MAXPIECESIZE parameter limits the size of a backup piece. By default, the RMAN utility will put the entire contents of a backup set into one backup piece, regardless of the size of the backup set. This parameter can be valuable for media managers that have size limitations.

For instance, if you have limitations of 2GB because of your media manager or operating system, the MAXPIECESIZE parameter can limit the size to 2GB, which will not violate the media management limitations. This will cause datafiles that are larger than 2GB to be split into backup pieces of 2GB.

Let's see how to set the MAXSETSIZE and MAXPIECESIZE parameters. The MAXSETSIZE can be used in both the CONFIGURE parameters and BACKUP command:

RMAN> configure channel device type disk maxsetsize=10G;
RMAN> backup database maxsetsize=10G;

RMAN> configure channel device type disk maxpiecesize = 2G;

Caution must be taken when using the MAXSETSIZE parameter. If the datafile being backed up is larger than the MAXSETSIZE parameter, the backup will fail.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset