Format for RMAN backup piece file name is unique

Using incorrect format when backing up to tape can cause an issue during recovery if the backup pieces have the same file name. For example if the format specified is format ‘fullhot_%d_%t.bus’ and multiple channels are used it could create file with the same name on the tape which will cause database restore fail and RMAN could generate the following error:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/06/2008 09:29:05
ORA-19615: some files not found in backup set
ORA-19613: datafile 45 not found in backup set

So using the following format fullhot_%d_%U_%t.bus can ensure the file name of the backup piece is unique.
%d – The name of the database.
%U – A convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup filenames. If you do not specify a format, RMAN uses %U by default.
%t = The backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of %s and %t can be used to form a unique name for the backup set.
To see information on other format option visit the URL http://www.ss64.com/ora/rman_format_string.html

Using the following Unix command one can verify if the file name is unique for a database. If the command below returns an output it means that back piece file is duplicate.
$ grep handle rman_ORATEST.log | awk -F’=’ ‘{print $2}’ | awk ‘{print $1}’ | sort | uniq -d

To check across all databases assuming that the RMAN log files are in one folder would compare within one and also across databases (e.g. DB1, DB2, DB3)
$ grep handle rman_DB1.log rman_DB2.log rman_DB3.log … | awk -F’=’ ‘{print $2}’ | awk ‘{print $1}’ | sort | uniq -d

One thought on “Format for RMAN backup piece file name is unique

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s