Powered By Blogger

Saturday, March 28, 2009

Restoring database to another machine using RMAN Backup


Restoring and Recovering a New Database using a Different database backup.
1.>> Destination database must be same version as the target database and also it must be of same platform.
2.>> Backup the source database using normal backup operation.
3.>> Transfer the backup files to new host (different host).
4.>> Create passwordfile for the new database same as source database.
5.>> Create pfile same as source database and change parameters according to the requirement.(Dont change the DB_ID value).
6.>> Create the instance same as Source database instance.
7.>> Configure Network services (TNS and Listener) for New DB.
8.>> Set DB_ID parameter as same as Source Database.
SET DBID 1340752057;
9.>> STARTUP NOMOUNT;
10.>> Restore and edit the server parameter file.Because you enabled the control file autobackup feature when making your backups,
the server parameter file is included in the backup sets.Allocate a channel to the media manager, then restore the server
parameter file (SPFILE) as a client-side pararameter file (PFILE).
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS='...';
RESTORE SPFILE TO PFILE '?/oradata/test/inittrgta.ora' FROM AUTOBACKUP;
SHUTDOWN ABORT;
}
Next, edit the restored PFILE . Change any location-specific parameters, for example, those ending in _DEST and _PATH,
to reflect the new directory structure. For example, edit the following parameters:
- IFILE
- *_DUMP_DEST
- LOG_ARCHIVE_DEST*
- CONTROL_FILES

11.>>Then restart the instance, using the edited PFILE:
STARTUP FORCE NOMOUNT PFILE='?/oradata/test/inittrgta.ora';
12.>>Restore the control file from an autobackup and then mount the database. RMAN restores the control file
to whatever location you specified in the CONTROL_FILES initialization parameter. For example:
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS='...';
RESTORE CONTROLFILE FROM AUTOBACKUP;
ALTER DATABASE MOUNT;
}
13.>>For example, consider the following RMAN script to perform these steps, which is contained in text file reco_test.rman:
RUN
{
# allocate a channel to the tape device
ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS='...';
# rename the datafiles and online redo logs
SET NEWNAME FOR DATAFILE 1 TO '?/oradata/test/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '?/oradata/test/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '?/oradata/test/cwmlite01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '?/oradata/test/drsys01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '?/oradata/test/example01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '?/oradata/test/indx01.dbf';
SET NEWNAME FOR DATAFILE 7 TO '?/oradata/test/tools01.dbf';
SET NEWNAME FOR DATAFILE 8 TO '?/oradata/test/users01.dbf';
SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo01.log''
TO ''?/oradata/test/redo01.log'' ";
SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo02.log''
TO ''?/oradata/test/redo02.log'' ";
# Do a SET UNTIL to prevent recovery of the online logs
SET UNTIL SCN 123456;
# restore the database and switch the datafile names
RESTORE DATABASE;
SWITCH DATAFILE ALL;
# recover the database
RECOVER DATABASE;
}
EXIT

14.>> Alter database open resetlogs;


*******************Sucessfully Completed********************************

No comments:

Post a Comment