Whenever we take backup through RMAN then RMAN automatically generates a file name for the backup piece or image copy. However we can override the default file name generation of RMAN by using FORMAT parameter.
FORMAT parameter order of precedence is
1)With backup specification.
Example: Here is use both format with Backup command and after datafile file_number comamnd. But later one i used. In this example I had CONFIGURE .... COPIES .. 2 settings that's why 2 pieces are generated.
RMAN> backup format '/oradata2/%U' datafile 4 format '/oradata2/users_1%U';
Starting backup at 30-APR-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=150 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/oradata2/data1/data1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 30-APR-08
channel ORA_DISK_1: finished piece 1 at 30-APR-08 with 2 copies and tag TAG20080430T133252
piece handle=/oradata2/users_12bjf4bc5_1_1 comment=NONE
piece handle=/oradata2/users_12bjf4bc5_1_2 comment=NONE
2) After BACKUP command.
BACKUP FORMAT ...
3)With the ALLOCATE CHANNEL command.
RUN
{
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/oradata2/a%U'
...
}
4)The CONFIGURE CHANNEL command.
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/?/%U';
Some Syntax:
----------------
%U: It specifies a system-generated unique filename. If no format is used then by default %U is used. The meaning of %U is different for image copies and backup pieces.
For a backup piece, %U specifies a convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup filenames.
For an image copy of a datafile, %U means the following:
data-D-%d_id-%I_TS-%N_FNO-%f_%u
For an image copy of an archived redo velog, %U means the following:
arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u
For an image copy of a control file, %U means the following:
cf-D_%d-id-%I_%u
%c: It specifies the copy number of the backup piece within a set of duplexed backup pieces. If you did not multiplex a backup(i.e by COPIES parameter), then this variable is 1 for backup sets and 0 for proxy copies.
%d: It specifies the name of the database.
%e Specifies the archived log sequence number.
%f Specifies the absolute file number.
%F Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name. This variable translates into c-IIIIIIIIII-YYYYMMDD-QQ
%h Specifies the archived redo log thread number.
%I Specifies the DBID.
%M Specifies the month in format MM.
%N Specifies the tablespace name.
%n Specifies the name of the database, padded on the right with x characters to a total length of eight characters.
%p Specifies the piece number within the backup set.
%s Specifies the backup set number.
%t Specifies the backup set time stamp
%T Specifies the year, month, and day in the format: YYYYMMDD.
%u Specifies an 8-character name constituted by compressed representations of the backup set or image copy number and the time the backup set or image copy was created.
%Y Specifies the year in this format: YYYY.
Example:
-----------
As today is 30 so whenever I use %D 30 is substituted.
RMAN> backup as copy datafile 4 format '/oradata2/%D%U';
Starting backup at 30-APR-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/oradata2/data1/data1/users01.dbf
output filename=/oradata2/30data_D-DATA1_I-2547250380_TS-USERS_FNO-4_2fjf4d1k tag=TAG20080430T140124 recid=11 stamp=653407284
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 30-APR-08
No comments:
Post a Comment