Migrating Oracle Database from one instance to another using RMAN

Source DB Version: 12.1.0.2.0
Target DB Version: 12.1.0.2.0

Steps to Migrate Database from one instance to another:

1) Take Full RMAN backup with archivelog & current controlfile from source db.
2) Copy pfile and password file from source db to target db
3) Restore RMAN backup on Target DB

On Source Side:

We will be targeting to take a hot backup assuming we dont have downtime, hence it is necessary that database is up and running, if not please start the database.

Just to note we can even take cold backup, my demonstration will be for hot backup.

sqlplus / as sysdba
startup

Please check if the LOG_MODE is Archive

select name,log_mode from v$database;

Check for correct ORACLE_SID, if not set the ORACLE_SID

echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)

Next step is to take RMAN Backup

RMAN> backup database plus archivelog;
RMAN> backup current controlfile;
RMAN> exit

Take a Pfile backup from the Source Instance

SQL> create pfile from spfile;

Go to ORACLE_HOME/dbs, copy the password file and pfile from SOURCE to TARGET

Copy the Backup files to the Target Database (You can use SCP, RSYNC, SFTP any method to move the file across)

On Target Side:

Assuming the backup files, Pfile and Password file is copied to the Target server, we will now proceed with restoration of database at Target

Check for correct ORACLE_SID, if not set the ORACLE_SID

echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)

sqlplus / as sysdba
startup nomount pfile='PATH_TO_PFILE';
create spfile from pfile;

After creating spfile we will now proceed with restoration of database.

rman target /

RMAN> restore controlfile from 'PATH_TO_CONTROL_FILE_BKP';
RMAN> alter database mount;
RMAN> catalog start with 'PATH_TO_DB_BACKUP_FILES';
RMAN> restore database;
RMAN> run{
2> set until sequence=16;
3> recover database;
4> }
RMAN> exit

After Restoration of the database lets open the database.

sqlplus / as sysdba
alter database open resetlogs;

Check the status of the restored database, it should be in READ WRITE Mode.

SQL> select name,open_mode,log_mode, version from v$database,v$instance;




Comments

Popular posts from this blog

Oracle SOA Application Migration - Lift and Shift