Databases Reference
In-Depth Information
Renaming Database Files in a Duplicate Database
Problem
You're planning to duplicate a database without OFA or ASM files and learn that there are multiple ways to specify file
names for the duplicate database. You want to find out which file-renaming method is best for you.
Solution
There are different file naming strategies you need to follow for naming regular directory structures as against an
OMF- or ASM-based data file storage. This solution is devoted to non-OMF and non-ASM file renaming strategies.
The next recipe discusses file naming strategies for OMF and ASM files.
There are multiple ways to rename files for a duplicate database when you use non-OMF and non-ASM file
storage, as summarized in the following list.
1.
Use the
set newname
command to name the file system data files and tempfiles.
You can employ the
set newname
command to rename data files before you issue the
duplicate database
command.
You need to include the
set newname
command inside an RMAN
run
block, as shown in the following example.
run
{
set newname for datafile 1 to '/u01/app/oracle/oradata/system01.dbf';
set newname for datafile 2 to '/u01/app/oracle/oradata/sysaux01.dbf';
set newname for datafile 3 to '/u01/app/oracle/oradata/undotbs01.dbf';
set newname for datafile 4 to '/u01/app/oracle/oradata/users01.dbf';
set newname for datafile 5 to '/u01/app/oracle/oradata/users02.dbf';
set newname for tempfile 1 to '/u01/app/oracle/oradata/temp01.dbf';
duplicate target database to dupdb
...
}
The example shown here demonstrates how to rename file names at the individfual data file level, using the
set newname
command. The following example shows how to execute the
set newname
command at the
database level
:
run
{
set newname for database to '/u01/app/oracle/oradata/%U';
duplicate target database to dupdb
...
}
2.
Use the
configure auxname
command to rename data files.
The
configure auxname
command achieves the same result as the
set newname
command, with the difference
being that once you configure the auxiliary file names, all subseqeuent
duplicate database
commands can use the
renamed file-name settings. With the
set newname
command, on the other hand, you'll have to specify the command
each time you duplicate a database.