Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore to another server

Status
Not open for further replies.

williey

Technical User
Jan 21, 2004
242
I have another instance on a DR server. How do I restore a cold backup on a test instance to the the DR server?

Do I have to create a duplicate test instance on the DR server ?

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 

There are many ways to copy an Oracle database to another server, just "search" the forum for an answer. [3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Just copy datafiles and control files to new server and do a rename of the database or you can use same name.
 
How do I get Oracle in the DR machine to recognize the DB and control files from Server 1 without losing the instance on the DR machine?

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
Hi,
You do not restore a cold backup to an existing instance...

( Restore implies a complete replacement/cloning of the saved instance, not adding its schema objects to another instance)

Create a new instance on the DR machine ( assuming enough resources) and do an Export/Import to move the saved data, etc to the DR machines existing instance from the restored one..you can then drop the new instance...Or just use it as yopur test instance..





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I do not want to move data to another instance. All I want to do is perform a restore of my cold backup to a DR server for DR testing purposes.

I currently replicate a few databases to the DR machine. Should I lose the server, I want to be able to restore to the DR machine.

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
Just follow these steps

Hope it helps you

You may find it necessary to duplicate (clone) an Oracle database. One method is to use import/export. This method can work fine, but what if your database is too big? Another method is to make a copy of the current database and rename it. This month I will present an article that explains the steps necessary to copy and rename a database. This article will assume that the original database is called PROD and you want to create a TEST duplicate database.

1.) Copy production database files and init.ora


The first step is to locate and copy all database files to their new location. You can use the view V$DATAFILE in the PROD database to locate these files. Before running the query from V$DATAFILE, ensure that you are connected to the PROD database by selecting from V$DATABASE:
SQL> select name from v$database;

NAME
---------------------------------------
PROD


SQL> select name from v$datafile;

NAME
---------------------------------------
/u08/app/oradata/PROD/system01.dbf
/u06/app/oradata/PROD/rbs01.dbf
/u07/app/oradata/PROD/temp01.dbf
/u10/app/oradata/PROD/userd01.dbf
/u09/app/oradata/PROD/userx01.dbf
After recording these files, shutdown the PROD database and perform an operating system copy of all database files to another location and/or machine. In my example, I will copy all datafiles to a new location as shown in the following table:
Old Location New Location
/u08/app/oradata/PROD/system01.dbf /u08/app/oradata/TEST/system01.dbf
/u06/app/oradata/PROD/rbs01.dbf /u06/app/oradata/TEST/rbs01.dbf
/u07/app/oradata/PROD/temp01.dbf /u07/app/oradata/TEST/temp01.dbf
/u10/app/oradata/PROD/userd01.dbf /u10/app/oradata/TEST/userd01.dbf
/u09/app/oradata/PROD/userx01.dbf /u09/app/oradata/TEST/userx01.dbf


After copying all files to their new location, startup the PROD database.

From the production database, get a copy of the initPROD.ora file and copy it to initTEST.ora. In the initTEST.ora file, change the value of "db_name" from PROD to TEST. Keep in mind that you may also need to change:

audit_file_dest
background_dump_dest
control_files
core_dump_dest
log_archive_dest
user_dump_dest
If the TEST database is going to be on a different machine, copy the initTEST.ora file to that machine in the proper directory.
2.) Create the script that will re-create the controlfile


Using SVRMGR on the PROD database, create a script that will be able to re-create the controlfile for the database.
PROD on testdb: svrmgrl
SVRMGR> connect internal
Connected.
SVRMGR> alter database backup controlfile to trace;
Statement processed.
The above statement will put a text copy of the controlfile in the USER_DUMP_DEST directory. You will need to search for the newest trace file in this directory. In UNIX you can use the "ls -lt" command. Once you find the correct trace file, rename it to cr_control.sql and edit it as follows:
Remove everything up to the "START NOMOUNT" statement and everything after the semicolon at the end of the "CREATE CONTROLFILE" statement.
Edit the line starting with "CREATE CONTROLFILE" and replace the word "REUSE" with the word "SET" right before the keyword DATABASE.
On the same line, modify the database name changing it from PROD to TEST.
On the same line, change the keyword NORESETLOGS to RESETLOGS.
Your script should now read:
Edited file cr_control.sql
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS NOARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 5
MAXDATAFILES 600
MAXINSTANCES 10
MAXLOGHISTORY 1000
LOGFILE
GROUP 1 (
'/u03/app/oradata/TEST/redo_g01a.log',
'/u04/app/oradata/TEST/redo_g01b.log',
'/u05/app/oradata/TEST/redo_g01c.log'
) SIZE 200K,
GROUP 2 (
'/u03/app/oradata/TEST/redo_g02a.log',
'/u04/app/oradata/TEST/redo_g02b.log',
'/u05/app/oradata/TEST/redo_g02c.log'
) SIZE 200K,
GROUP 3 (
'/u03/app/oradata/TEST/redo_g03a.log',
'/u04/app/oradata/TEST/redo_g03b.log',
'/u05/app/oradata/TEST/redo_g03c.log'
) SIZE 200K
DATAFILE
'/u08/app/oradata/TEST/system01.dbf',
'/u06/app/oradata/TEST/rbs01.dbf',
'/u07/app/oradata/TEST/temp01.dbf',
'/u10/app/oradata/TEST/userd01.dbf',
'/u09/app/oradata/TEST/userx01.dbf'
;

If the TEST database is on a different machine move this file to that machine.

3.) Create the new controlfile for TEST


Make sure that your Oracle environment variable "ORACLE_SID" is set to TEST. (i.e. export ORACLE_SID=TEST).
Now use SVRMGR and the CREATE CONTROLFILE script (cr_control.sql) to create your controlfile for TEST:

TEST on testdb: svrmgrl
SVRMGR> connect internal
Connected to an idle instance.
SVRMGR> @cr_control
ORACLE instance started.
Total System Global Area 32798752 bytes
Fixed Size 39816 bytes
Variable Size 22600856 bytes
Database Buffers 9994240 bytes
Redo Buffers 163840 bytes
Statement processed.
SVRMGR>
NOTE: Stay logged into SVRMGR and proceed to the next step.
4.) Open the TEST database


Before opening the TEST database, you will need to perform incomplete recovery. After recovery you can open the database using the RESETLOGS option as show below:
SVRMGR> alter database recover database until cancel using backup controlfile;
SVRMGR> alter database recover cancel;
Statement processed.
SVRMGR> alter database open resetlogs;
Statement processed.
SVRMGR>
You can verify that the database was renamed to TEST by querying from V$DATABASE:
SVRMGR> select name from v$database;
NAME
---------
TEST
1 row selected.
SVRMGR>
 
The example is based on 8i. I running 9i now. Oracle has discontinued SVRMGR. The init.ora setup is different is 9i too.

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top