RMAN Restore Database to Different Server
Release 1.0.0
December 2013
RMAN restore Database to Different Server on Oracle Linux , Release 1.0.0
Copyright © 2013, FCI Accelerated Solutions Inc. All rights reserved.
Primary Author: Junaid Qureshi
Last Revision: December 19, 2013
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify,
license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means.
Reverse engineering, disassembly, or recompilation of this software, unless required by law for
Interoperability is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any
errors, please report them to us in writing.
RMAN Restore Database to Different Server
Release 1.0.0 December 2013
Table of Contents
Preface...............................................................................................................................................................
Audence........................................................................................................................................................
Supporting Documentation...........................................................................................................................
Pre-requisite.................................................................................................................................................
Set DBID and Oracle SID on Destination Server........................................................................................
Locate Backup of INIT/SPFILE and restore on Destination Server............................................................
Shutdown/Startup Database in Nomount Mode...........................................................................................
Restore Control File on Destination Server.................................................................................................
Change Database to Mount Mode................................................................................................................
Create database directory structure on Destination Server...........................................................................
Run RMAN restore database........................................................................................................................
Run RMAN recover database.......................................................................................................................
Change Database to Open Mode with RESETLOGS..................................................................................
Make Backup of Database on Destination Server........................................................................................
1
RMAN Restore Database to Different Server
Release 1.0.0 December 2013
Preface
Audience
The iTracIMS® RMAN restore Database to Different Server on Oracle Linux guide is intended for System Administrator
or Database Administrator responsible for configuring Oracle database and Linux environment.
To use this white paper you must have administrative privileges on the Server where you will use Oracle RMAN backup
to restore database on Destination Server. You must have root privileges on system and familiarity with Linux Operating
System. You must have experience in Oracle database administration configuration and installation.
Supporting Documentation
Oracle Database Backup and Recovery Reference
[Link]
Advanced RMAN Recovery Techniques
[Link]
2
RMAN Restore Database to Different Server
Release 1.0.0 December 2013
RMAN Restore Database to Different Server
Pre-requisite
Have a RMAN backup of Source Database with Controlfile and INIT/SPFILE.
1.) Set DBID and ORACLE SID of Source Database on Destination Server
[oracle@FCIAS-ORADEV-1 admin]$ ORACLE_SID=DEV11242
[oracle@FCIAS-ORADEV-1 admin]$ set ORACLE_SID
[oracle@FCIAS-ORADEV-1 admin]$ echo $ORACLE_SID
DEV11242
RMAN> connect target /
RMAN>set dbid=11111111
executing command: SET DBID
RMAN> startup force nomount;
2.) Locate your backup INIT/SPFILE and Restore to Destination Server
RMAN>restore spfile from ‘Location of your backup INIT/SPFILE’ ;
RMAN>shutdown immediate
3.) Shutdown and Startup Database on Destination Server in NOMOUNT mode
RMAN>startup nomount
4.) Locate your backup CONTROL FILE and Restore to Destination Server
RMAN> connect target /
connected to target database: DEV11242 (not mounted)
RMAN> restore CONTROLFILE from ‘/backup directory/controlfilename’;
5.) Bring Database on Destination Server to MOUNT mode
RMAN>alter database mount;
6.) Create database directory structure on Destination Server
You can query the source database to locate the directories for tablespaces.
3
RMAN Restore Database to Different Server
Release 1.0.0 December 2013
SQL> select file#, name from V$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 /u01/app/oracle/oradata/DEV11242/[Link]
2 /u01/app/oracle/oradata/DEV11242/[Link]
3 /u01/app/oracle/oradata/DEV11242/[Link]
4 /u01/app/oracle/oradata/DEV11242/[Link]
5 /u02/app/oracle/oradata/DEV11242/itrac_wsis.dbf
6 /u02/app/oracle/oradata/DEV11242/itrac_uofr.dbf
7 /u02/app/oracle/oradata/DEV11242/itrac_ccms.dbf
8 /u02/app/oracle/oradata/DEV11242/[Link]
9 /u02/app/oracle/oradata/DEV11242/oasis_ito.dbf
10 /u02/app/oracle/oradata/DEV11242/itrac_sktel.dbf
You will need to create the same directory structure on the Destination Server.
e.g. mkdir /u01/app/oracle/oradata/DEV11242
e.g. mkdir /u02/app/oracle/oradata/DEV11242
You will need to view your INIT/SPFILE file to find directory structure for Control Files, Archive Logs, DUMPS, Audit
files etc and create these directory structure on the destination server.
7.) Run RMAN RESTORE DATABASE to apply RMAN backup pieces of Source Database
RMAN> Restore database;
This should restore all your data files to the directory structure created in the prior step.
8.) Run RMAN RECOVER DATABASE to apply all the archive logs on Destination Server
Media recovery reapplies all changes from the archived and online redo logs and available incremental backups to
datafiles restored from backup.
RMAN> Recover database;
4
RMAN Restore Database to Different Server
Release 1.0.0 December 2013
9.) Open the database and reset logs
RMAN> alter database open resetlogs;
Once you have opened the database on Destination Server with RESETLOGS, run a full backup. This is important as
should you suffer a failure you will not be able to perform a second recovery because after resttings the logs the SCN
numbers will no longer match any older backup files.
10.) Backup Database running on Destination Server
configure controlfile autobackup on;
set command id to 'ORADEVFull';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;
ALLOCATE CHANNEL c3 DEVICE TYPE disk;
ALLOCATE CHANNEL c4 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database tag SID_FULL format
'/NAS/Backup/Oracle/ORADEV/%d_%T_%s_%p_FULL' ;
sql 'alter system archive log current';
backup tag ORCL_ARCHIVE format '/NAS/Backup/Oracle/ORADEV/%d_%T_%s_%p_ARCHIVE' archivelog
all;
backup tag ORCL_CONTROL current controlfile format '/NAS/Backup/Oracle/ORADEV/%d_%T_%s_
%p_CONTROL';
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;