Restore RMAN backup to another server/instance

Posted on 2014-03-11
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 22

Accepted Solution

Steve Wales earned 250 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 45

Author Comment

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

And it is Windows.  :(

LVL 22

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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Assisted Solution

Pepe2323 earned 250 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 22

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 45

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 22

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 45

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 22

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 45

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 22

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 45

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Developer 6 75
PL/SQL Two changes 7 41
sum of columns in a row in oracle 3 42
oracle differnce between two timestamps 5 38
Introduction A previously published article on Experts Exchange ("Joins in Oracle", makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

749 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