I am an Oracle Database Specialist in Singapore.
EU visitors : Please note that this site uses cookies.

26 July, 2015

RMAN -- 5c : (Some More) Useful KEYWORDs and SubClauses

Here are a few more useful KEYWORDs and SubClauses

AS COPY and COPY OF
Unlike the BACKUPSET format that is the default for an RMAN Backup, Image Copy backups (those that would be akin to backups created as User Managed Backups without RMAN) can be created in RMAN using the AS COPY specifer. COPY OF allows backups of such backup copies.

Thus, I take an Image Copy backup of a datafile while the database is OPEN :

Did you note how datafile 7 was copied to '/NEW_FS/oracle/FRA/HEMANTDB/datafile/o1_mf_hemant_bv9s6b4o_.dbf' by the BACKUP AS COPY command ?
Without me specifying a FORMAT, it created the copy in the datafile location under the FRA, not in the backupset location.
Next, I take a backup of this Image Copy backup.

This time the copy in the datafile location was backed up to a backupset location. This new backup is not an Image Copy format of datafile 7. Note the differences in the filenames. The Image Copy done with BACKUP AS COPY has an OMF filename similar to that of the source datafile. The BackupSet format includes the TAG as part of the BackupPiece filename.

The LIST BACKUP command shows me the BackupSet backup of the Image Copy. If I want to see the Image Copy that I created first, I must run the command LIST COPY. LIST BACKUP shows BackupSets, not Image Copies themselves. Image Copies are displayed by the LIST COPY.

What is the advantage of Image Copy Backups ? There are a few.
1) You can integrate this with your User Managed Backups methods.
2) You can "clone" a database without having to run a RESTORE(yes, with BACKUP AS COPY DATABASE)
3) You can selectively relocate one or more datafiles with additonal usage of the SWITCH DATAFILE TO COPY command (see my previous post "BACKUP AS COPY")

Note how all the datafiles of the tablespace were copied and then the active copy of the datafiles has been switched to the new location (/NEW_FS/oracle/FRA/HEMANTDB/datafile/). Have the old datafiles (/home/oracle/app/oracle/oradata/HEMANTDB/datafile/) been deleted ?
Let's see :