# RMAN Example: Performing a Duplicate Restore

Perform a duplicate restore to create a copy of a database. An example script follows.

You can redirect the database files to a different location on the destination than that of the source. In the following example the `set newname` command accomplishes this. The script could also create redologs in a new location on the destination database, as shown in the following example. For redirecting the database files and log files to new locations, the `db_file_name_convert` and `log_file_name_convert` parameters may be set to the new values (locations) in the pfile of the auxiliary instance.

## Procedure

1. Set up an auxiliary instance for a duplicate database. Refer to Setting Up Instances for Oracle Auxiliary Databases for details.

2. Execute the script, with the necessary modifications, from the rman prompt on the destination Oracle database server. The destination database is the auxilary instance.

## Example

    run
    {
    set newname for database to '$[desired location]/%U';
    allocate auxiliary channel ch1 type sbt
    PARMS="SBT_LIBRARY=$[Oracle plugin location]/libobk.so,ENV=(ThreadCommandLine=--cv-host $[Backup host hostname] --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name])";
    allocate auxiliary channel ch2 type sbt
    PARMS="SBT_LIBRARY=$[Oracle plugin location]/libobk.so,ENV=(ThreadCommandLine=--cv-host $[Backup host hostname] --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name])";
    allocate auxiliary channel ch3 type sbt
    PARMS="SBT_LIBRARY=$[Oracle plugin location]/libobk.so,ENV=(ThreadCommandLine=--cv-host $[Backup host hostname] --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name])";
    allocate auxiliary channel ch4 type sbt
    PARMS="SBT_LIBRARY=$[Oracle plugin location]/libobk.so,ENV=(ThreadCommandLine=--cv-host $[Backup host hostname] --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name])";
    duplicate target database to '$[auxiliary instance]'
    PFILE=$[ORACLE_HOME]/dbs/init$[auxiliary instance].ora
    LOGFILE
    GROUP 1
    (
    '$[desired location]/redo01.log'
    )  SIZE 10M REUSE,
    GROUP 2
    (
    '$[desired location]/redo02.log'
    )  SIZE 10M REUSE,
    GROUP 3
    (
    '$[desired location]/redo03.log'
    )  SIZE 10M REUSE
    ;

×

Loading...