Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Restore RMAN backup to another server/instance

Posted on 2014-03-11
Medium Priority
Last Modified: 2014-04-16
I've got an RMAN backup that was taken on server A.  I need to restore the backup to an instance on server B, keeping the database name that's already on B.  The two servers are in different domains.

This is Oracle 10g.

Is there a good writeup or advise on how to do this?  It seems that the articles that I've found don't agree on the steps and/or complexity.

Question by:Kent Olsen
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
LVL 23

Accepted Solution

Steve Wales earned 1000 total points
ID: 39921615
It's not overly difficult.

You don't say what OS you're on, because there's extra steps involved in windows (you need to create the service using ORADIM before you start) that are not required in Unix.

Start by copying the backup files you need over to the new server.
Get a modified init.ora file on the server somewhere that includes the directives DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT to rename your data and log files during the copy.


If directory locations on the new server are exactly the same, and the file names are exactly the same, I guess you don't need those.

Start up your new database NOMOUNT, pointing to the pfile you've created (make sure that changes such as database name, domain name, memory settings and the two parameters above are set in there).

Invoke RMAN:  rman auxiliary /

Then run this script:

allocate auxiliary channel aux1 device type disk;
duplicate database to new_db_name until time "to_date('2014-03-11 08:00:00','YYYY-MM-DD HH24:MI:SS')" backup location '/path/to/your/backups';

Open in new window

It will go looking for the autobackup of the controlfile from your source backup and do the duplicate.  If your backup is an offline backup, you don't need the until time part of the duplicate command.  If you can connect to both databases (your source as target and your new one as auxiliary, and server B can read from server A backup destination) then you don't need backup location either.  It can read that from the source controlfile.

Make sure that when you copy the backup files over, you have everything - the full/incremental level 0, and differentials, logs and controlfile backups.

I have a couple of windows environments where I do it this way and a couple of unix environments where the backup location from prod is mounted on the test box when we need to do a restore.

When done, stop and restart the database with an init.ora that doesn't have the CONVERT parameters.  Create the spfile from your pfile and if it's a test database that you don't want in archivelog mode, turn that off.
LVL 46

Author Comment

by:Kent Olsen
ID: 39921626
Cool.  I'll give that a shot.  Thanks.

And it is Windows.  :(

LVL 23

Expert Comment

by:Steve Wales
ID: 39921634
Creating the database service on windows is pretty easy:

oradim -new -sid newdb -startmode auto -pfile 'c:\oracle\product\10.2.0\db_1\dbs\initnewdb.ora'

Then you can continue from there as described above.

Make sure you execute the command using a privileged account etc :)  Not everyone can create a service.

You are probably better off copying the backups from A to B then, if you're on Windows.

Oracle services accessing remote disks is a pain.  I had no end of troubles when I had a test machine set up using a domain account as the service owner that could access my prod backup location.  Caused me way more trouble than it was worth so I went back to the default ownership of the service - but then the backups for this particular machine aren't incredibly large and I can copy everything I need over in 30-60 minutes usually.
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.


Assisted Solution

Pepe2323 earned 1000 total points
ID: 39922625

what i have done to do something like this is:

- Move the rman backup to the Server B
- Copy pfile to the server b, put the pfile $ORACLE_HOME/dbs
- set pfile as cluster = false

rman nocatalog

connect target /

shutdown abort;
startup nomount;

Restore control files

RMAN> restore controlfile from 'path/backup_file'
alter database mount;
restore database;
recover database;

When recover finish:
shut immediate

sqlplus  / as sysdba

Pretty Much those are steps i follow

LVL 23

Expert Comment

by:Steve Wales
ID: 39922639
Both methods are valid.  One is a pure restore which will restore everything in the same format as the original - pathing, names, DBID ... everything.

The other is a copy that lets you move things around as you do the restore and change the name etc.

Depends on the exact requirements of the OP.
LVL 46

Author Comment

by:Kent Olsen
ID: 39924702
I'm looking for an easily repeatable process.  I've got several dozen instances that I'm going to rehost.  They all have the same file structure so all I really need to do is lay the instance over an existing instance and make sure that the new instance name is correct.

I tried Pepe's solution.  The (original) spfile isn't being picked up.  The "alter database mount" is failing with "database name {backup name} is not {instance name}".
LVL 23

Expert Comment

by:Steve Wales
ID: 39924857
If all you are doing is moving the databases from one machine to another and everything else is the same (same OS version, same DB version, same disk layout, same everything) you could shut the DB down, move everything over to the new server and start it up.

I have done that before I seem to recall.

Depends if you can stand the outage to get it done.
LVL 46

Author Comment

by:Kent Olsen
ID: 39926099
An outage isn't a problem.

I was actually wondering if it would be easier to drop the instance and recreate it.
LVL 23

Expert Comment

by:Steve Wales
ID: 39926138
Just wondering how that would help here ?  You still need to get the data, users, etc over to the new server.

Doing a copy via RMAN, or copying the files from an offline backup will move everything that makes up the internals with it.

If you have to create a new DB and then copy the data, you have issues with recreating all the internals - users, roles, permissions, code, etc.
LVL 46

Author Comment

by:Kent Olsen
ID: 39926541
I'm not sure that it would help.  And thinking about it some more, it probably doesn't.

The way our environment is set up, we've never had to do an instance restore from the RMAN backups.  Authentication stays with the server so we've used imp/exp or impdp/expdp to move data between servers when we had to.

Our business model is changing and I'm drawing a blank on the RMAN restore.  I haven't seen it in 8 years.
LVL 23

Expert Comment

by:Steve Wales
ID: 39999650
Wanted to make sure you have what you needed from the above, Kdo.

There have been 2 ways presented to you - a duplicate or a restore - both have different ways of handling things.

The duplicate will assign a new DBID to the copied database, a restore will end up with the same DBID.

I am more than willing to go through either in detail if needed - want to make sure you have not been left hanging - your last reply doesn't indicate if you need further assistance or not :)
LVL 46

Author Comment

by:Kent Olsen
ID: 40005549
Hi guys,

I wound up choosing door number 3 -- Create a new instance and restore the containers to the instance directories.

Thanks for the help!


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question