# RMAN Example: Performing a Cross-Machine Restore

Perform a cross-machine restore when you need to restore a database to a host different than that on which the backup was made. An example follows.

- The script can include mounting the database after restoring the control file, and the example includes allocation of the required number of channels for efficiency.

- In the following example the database files are directed to a different location on the destination than their location on the source. The `set newname` and `switch datafile all` commands in the script accomplish this. The script could also create redologs in a new location on the destination database.

## Procedure

1. Execute the script from the rman prompt on the destination Oracle database server. The destination server must also be configured with the Oracle agentless plugin and have the database in `nomount` mode with the parameter file (pfile). The control file is being restored in the following sample script.

2. Set the `dbid` of the source database to restore the control file from the source to the destination.

## Example

    set dbid $[dbid number];
    run
    {
    allocate channel $[ch1] type sbt PARMS="SBT_LIBRARY=$[Oracle plugin location]/libcvobk_thinlibrary.so";
    send "--cv-host $[Backup host hostname]  --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name]";
    restore controlfile from autobackup;
    sql '$[alter database mount]';
    }
    run
    {
    #******DATA RESTORE SCRIPT******#
    set newname for database to "$[desired location]/%U";
    allocate channel $[ch1] type sbt PARMS="SBT_LIBRARY=$[Oracle plugin location]/libcvobk_thinlibrary.so";
    allocate channel $[ch2] type sbt PARMS="SBT_LIBRARY=$[Oracle plugin location]/libcvobk_thinlibrary.so";
    send "--cv-host $[Backup host hostname]  --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name]";
    restore database;
    switch datafile all;
    }
    run
    {
    allocate channel $[ch1] type sbt PARMS="SBT_LIBRARY=$[Oracle plugin location]/libcvobk_thinlibrary.so";
    send "--cv-host $[Backup host hostname]  --cv-clientname $[Pseudo client name] --cv-instance $[Oracle Instance Name]";
    recover database;
    sql '$[alter database open]';
    }

×

Loading...