Creating Image File Copy Backups with RMAN

When using RMAN to back up to disk you have two options in how to write the backups. The default is a backup set which uses unused block compression and is in an RMAN-specific format. The other method is an image copy that is a bit for bit copy of the data file, archive redo log file or control file.

This document will detail making backups as image file copies and how to change the default backup type to image file copies. 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 09:12:02 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>

The current RMAN configuration is for backup sets. This can be seen by the line CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET. Even with the current settings it is possible to create an image file copy backup with the command BACKUP AS COPY DATABASE. Below is an example.

RMAN> backup as copy database;

Starting backup at 25-AUG-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=42 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u02/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00002 name=/u02/app/oracle/oradata/orcl/sysaux01.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-SYSAUX_FNO-2_2rlm7e7p tag=TAG20100825T095504 RECID=4 STAMP=727955829
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:02:10
channel ORA_DISK_2: starting datafile copy
input datafile file number=00007 name=/u03/app/oracle/oradata/orcl/dbfs01.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-SYSTEM_FNO-1_2qlm7e7p tag=TAG20100825T095504 RECID=5 STAMP=727955844
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:27
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u02/app/oracle/oradata/orcl/undotbs01.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-UNDOTBS1_FNO-3_2tlm7ecd tag=TAG20100825T095504 RECID=6 STAMP=727955891
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u02/app/oracle/oradata/orcl/example01.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-EXAMPLE_FNO-5_2ulm7eds tag=TAG20100825T095504 RECID=7 STAMP=727955933
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u02/app/oracle/oradata/orcl/users01.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-DBFS_FNO-7_2slm7ebs tag=TAG20100825T095504 RECID=8 STAMP=727955935
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:01:44
channel ORA_DISK_2: starting datafile copy
input datafile file number=00006 name=/u02/app/oracle/oradata/orcl/test.dbf
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-USERS_FNO-4_2vlm7ef5 tag=TAG20100825T095504 RECID=10 STAMP=727955952
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:17
output file name=/u03/app/oracle/oradata/orcl/backup/data_D-ORCL_I-1239150297_TS-TEST_FNO-6_30lm7ef6 tag=TAG20100825T095504 RECID=9 STAMP=727955949
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:16
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-00 comment=NONE
Finished Control File and SPFILE Autobackup at 25-AUG-10

RMAN>

Notice how the database SID, DBID, tablespace name and file number are encoded into the output file name. To make image file copies the default change the backup type from BACKUPSET to COPY.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COPY;

old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COPY;
new RMAN configuration parameters are successfully stored

RMAN> 

Now all backup commands will default to image copies unless overridden.

1 thought on “Creating Image File Copy Backups with RMAN”

  1. Thanks for your post, but i have some doubts about this.

    can i recover database using this image copy backup?

    How to recover?

    please tellme

Leave a Reply

Your email address will not be published. Required fields are marked *