This is a premium alert message you can set from Layout! Get Now!

Restore and Recover database to a new host with different directory structure

Anup
1

Restore and Recover database to a new host with different directory structure

In this case DBID of the database will be the same as of original database.

Source Configuration:

Host Name
SUN1
DB Name
PROD
Database Location
/DB/PROD
Backup Location
/RMAN_BKP
Archive Location
/archive

Target Configuration:

Host Name
SUN2
DB Name
PROD
Database Location
/INDIAN/PROD
Backup Location
/INDIAN/RMAN_BKP
Archive Location
/INDIAN/archive



Step 1 Take a full backup of Source Database

RMAN> backup database plus archivelog;
RMAN>backup spfile; - if you are using spfile , other wise take backup of pfile by using os command.

Step 2 Transfer these backup pieces to target machine (/INDIAN/RMAN_BKP location)

Step 3 Determine the DBID of source machine

SQL> select dbid from v$database;

DBID
----------
142618240

Step 4
Now perform task on target machine
First set ORACLE_SID, ORACLE_HOME and PATH then connect to rman

Step 5 Set DBID and restore spfile or pfile.

RMAN> set dbid 142618240
executing command: SET DBID

RMAN> startup nomount

Step 6 Restore pfile.
RMAN> restore spfile to pfile '/export/home/oracle/oracle/product/10.2.0/db_1/dbs/initPROD.ora' from '/INDIAN/RMAN_BKP/c-142618240-20100927-01';

Step 7 after restoration of pfile from spfile backup . shutdown the instance.

RMAN> shutdown immediate

Step 8 Open parameter file and edit control_files parameter to new location (/INDIAN/PROD/)

Step 7 Start the instance with pfile.

RMAN> STARTUP FORCE NOMOUNT

Step 8 Restore and Mount the Control file on Target Instance

RMAN> restore controlfile from '/INDIAN/RMAN_BKP/c-142618240-20100927-01';
RMAN> ALTER DATABASE MOUNT;

Step 9 Catalog the all backup piece

RMAN> catalog backuppiece '/DB/RMAN_BKP/TAG20080506T150716_421c355f_.bkp';
-…..
…..
….
RMAN> list backup

Step 10 Restore the database to new location (/INDIAN/PROD)

A) From SQL*Plus determine the data file and redo log file name.

SQL> SELECT FILE# AS "File/Grp#", NAME FROM V$DATAFILE
UNION
SELECT GROUP#,MEMBER FROM V$LOGFILE

B) Make a script by issuing SET NEWNAME and run.

run
{
set newname for datafile '/DB/PROD/system01.dbf' to '/DB/ANUP/system01.dbf';
set newname for datafile '/DB/PROD/undotbs01.dbf' to '/DB/ANUP/undotbs01.dbf';
set newname for datafile '/DB/PROD/sysaux01.dbf' to '/DB/ANUP/sysaux01.dbf';
set newname for datafile '/DB/PROD/users01.dbf' to '/DB/ANUP/users01.dbf';
set newname for datafile '/DB/PROD/example01.dbf' to '/DB/ANUP/example01.dbf';
set newname for datafile '/DB/PROD/RMAN.DBF' to '/DB/ANUP/RMAN.dbf';
set newname for datafile '/DB/PROD/a.sql' to '/DB/ANUP/a.sql';
restore database;
switch datafile all;
}

Step 11 Restore Backup archive log file to new location.

run
{
set archivelog destination to '/DB/archive';
restore archivelog all;
}

Step 12 Recover the database

RMAN > recover database;

Step 13 Relocate Log file location.

alter database rename file '/DB/PROD/redo01.log' to '/DB/ANUP/redo01.log';

Database altered.

alter database rename file '/DB/PROD/redo02.log' to '/DB/ANUP/redo02.log';

Database altered.

alter database rename file '/DB/PROD/redo03.log' to '/DB/ANUP/redo03.log';

Step 14 Open the Database resetlogs option.

RMAN> alter database open resetlogs;




























Post a Comment

1 Comments

Please Select Embedded Mode To show the Comment System.*

Join the conversation(1)
To Top