| Oracle® Database Backup and Recovery Reference 10g Release 2 (10.2) Part Number B14194-02 |
|
|
View PDF |
Syntax
fileNameConversionSpec::=

Purpose
A subclause that specifies one or more patterns to be used in generating new database file names based on old ones. Used with BACKUP , CONVERT and DUPLICATE as one way of generating output file names.
Restrictions and Usage Notes
The rules for these patterns and how they affect file naming are the same as those for the initialization parameter DB_FILE_NAME_CONVERT. In parentheses, provide an even number of string patterns.
When a new filename is generated based on an old one, the original filename is compared to the first member of each pair of string patterns. The first time a pattern is found which is a substring of the original filename, the new filename is generated by substituting the second member of the pair for the substring that matched.
Set the string_pattern to a value such as:
DB_FILE_NAME_CONVERT = ('string1' , 'string2' , 'string3' , 'string4' ...)
Where:
string1 is a pattern matching the orignal filename
string2 is the pattern replacing string1 in the generated filename
string3 is a pattern matching the orignal filename
string4 is the pattern replacing string3 in the generated filename
You can use as many pairs of primary and standby replacement strings as required.
For example, when making image copy backups of tablespaces users (with datafiles in directory /disk1/dbs/users) and tools (with datafiles in /disk1/dbs/tools/), to direct the converted datafiles to /newdisk/users and /newdisk/tools respectively, use the DB_FILE_NAME_CONVERT pattern shown here:
BACKUP AS COPY TABLESPACE users, tools DB_FILE_NAME_CONVERT = ('disk1/dbs','newdisk');
For each datafile to be converted where 'disk1/dbs' is a substring of the filename, the new filename is created by replacing 'disk1/dbs' with 'newdisk'. For example, the converted datafile corresponding to /disk1/dbs/users/users01.dbf is stored in /newdisk/users/users01.dbf, the converted datafile corresponding to /disk1/dbs/tools/tools01.dbf is stored in /newdisk/tools/tools.dbf, and so on.
Be aware of the following details:
The pattern does not have to match at the beginning of the filename. In the previous example, the match of the pattern to the original filename began at the second character. The command
BACKUP AS COPY TABLESPACE users DB_FILE_NAME_CONVERT = ('dbs','newdbs');
would direct the image copies to /disk1/newdbs/users and /disk1/newdbs/tools.
When there are multiple possible matches for a given filename being converted, the first match in the list of patterns is used to generate the new filename. The command
BACKUP AS COPY TABLESPACE users DB_FILE_NAME_CONVERT = ('dbs','newdbs','/disk1','/newdisk');
would have the same effect as the previous example, because the pattern 'dbs' matches the filename and there is no reason to compare it to the second pattern '/disk1'.
Keywords and Parameters
| Syntax Element | Description |
|---|---|
'string_pattern' |
Specifies the pattern, consisting of the pairs of strings used to convert the filenames.. |
Examples
Using DB_FILE_NAME_CONVERT with Multiple String Patterns: Example This example shows the use of DB_FILE_NAME_CONVERT with BACKUP AS COPY to create image copies of the users and tools tablespaces from the previous discussion, directing users to /newdisk1 and tools to /newdisk2:
BACKUP AS COPY DEVICE TYPE DISK
DB_FILE_NAME_CONVERT=('/disk1/dbs/users','/newdisk1',
'/disk1/dbs/tools','/newdisk2')
TABLESPACE tools, users;