Hello friends, in this article I’m going to demonstrate to you Restore RMAN Backup with a Different Database Name on New Server step-by-step guide.
Restore oracle database from rman backup to another server
Steps to Clone database to different DB name use RMAN
- Full or Level 0 Database RMAN backup.
- Controlfile backup.
- spfile backup.
- Password file backup.
How do you backup and restore an Oracle database with RMAN basic?
Taking Full or Level 0 Database RMAN backup
Before taking RMAN backup need to check the data file, audit file, and controlfile path for knowledge. In my case, the all Datafiles location is: "/u01/app/oracle/oradata/db11g/"
/u01/app/oracle/oradata/db11g/control01.ctl /u01/app/oracle/fast_recovery_area/db11g/control02.ctl /u01/app/oracle/control03.ctl
Audit file Location: "/u01/app/oracle/admin/db11g/adump/"
Now I’m going to take Database full Backup with controlfile and spfile using RMAN.
Before executing the backup command, must be checked control file auto backup on or not if not then configure it otherwise you need to take control file backup separately, in my case-control file auto backup is on.
$rman target/ RMAN> backup database; or RMAN> backup database plus archivelog;
Once your database backup is completed successfully, Now copy the above backup on New server with a password file if forget to copy the password file then you need to create a password manually.
The Newly configured server must have installed Oracle binary. Check here how to install Oracle on Linux.
- How to Install Oracle 12c on RHEL6
- How to Install Oracle 11g on RHEL6
We have two ways to restore RMAN Backup
- With the same directory structure as our production environment.
- You don’t want to follow the same directory structure then use the SET NEWNAME parameter.
How do I restore RMAN server from one server to another?
After copying the RMAN Backup we need to create a few directories which are required if you want the same directory structure as your production otherwise you can ignore it safely and go with the second method.
In my case, I’m going with the first method.
mkdir -p /u01/app/oracle/admin/db11g/adump/ mkdir -p /u01/app/oracle/oradata/db11g/ mkdir -p /u01/app/oracle/fast_recovery_area/db11g/
After creating the above directories now we start the restoration steps, just follow me.
Step-1. Copy spfile and password file on its real location.
$cp /u01/backup/spfiledb11g.ora /u01/app/oracle/product/184.108.40.206/db_1/dbs/ $cp /u01/backup/orapwdb11g /u01/app/oracle/product/220.127.116.11/db_1/dbs/
After copying above both files now create a pfile using spfile and check all directory structures, if any directory is not available then create it.
Step-2. Now start Database at nomount stage.
$sqlplus / as sysdba SQL> startup nomount
Restore Controlfile from RMAN backup
Now connect with RMAN and restore controlfile from controlfile Backup using the following.
$ rman target/ RMAN> restore controlfile from ‘/u01/backup/o1_mf_s_1013679379_glqyxx3b_.bkp’; Starting restore at 15-JUL-19 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=20 device type=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 output file name=/u01/app/oracle/oradata/db11g/control01.ctl output file name=/u01/app/oracle/fast_recovery_area/db11g/control02.ctl output file name=/u01/app/oracle/control03.ctl Finished restore at 15-JUL-19
After the restoration of controlfile now mount the Database
RMAN> alter database mount; database mounted released channel: ORA_DISK_1
Restore Database from RMAN Backup
Step-3. Now Catalog the Database Database start the restoration.
RMAN> catalog start with ‘/u01/backup/’; Do you really want to catalog the above files (enter YES or NO)? yes
After the catalog, start the restoration of the database.
RMAN> restore database;
Once the restoration is completed recovering the database.
Step-4. Run Last Command “Recover Database”
RMAN> recover database; Starting recover at 15-JUL-19 using channel ORA_DISK_1 starting media recovery unable to find archived log archived log thread=1 sequence=32 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 07/15/2019 17:26:11 RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 32 and starting SCN of 1505852
The above error is common, due to missing archive, we do not restore Archive files in this restoration. Now Exit from the RMAN prompt and connect with the SQL prompt.
Step-5. Connect with SQL prompt and open your database.
$ sqlplus / as sysdba SQL> alter database open; alter database open * ERROR at line 1: ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
After restoration, we need to open the database with the RESETLOGS keyword.
SQL> alter database open resetlogs;
Congratulation you have successfully restored the Database on a Newly created server. Please write in the comment box if you learn how to Restore RMAN Backup with a Different Database Name.
Connect with me on: