Restore rman backup to different server with different database name

Here we will Restore rman backup to different server with different database name. Perform backup on production server and we will restore it on any QC,DEV or UAT server.

 

restore rman backup to different server
restore rman backup to different server
 

We have taken “RMAN backup” of PROD and will restore rman backup to different server with different database name.

 
Let’s take two servers as below:

SERVER1—PROD
SERVER2—TEST

ON SERVER1:


DB Name: PROD

Take backup of PROD with archive log, control file and spfile.
 
RUN
{
    sql ‘alter system archive log current’;
    BACKUP AS compressed backupset filesperset 8 DATABASE FORMAT ‘/Backup01/DB_%d_%p_%T_%s.rbkp’ TAG DAILY_HOT_BACKUP;
    sql ‘alter system archive log current’;
    BACKUP AS compressed backupset ARCHIVELOG ALL NOT BACKED UP 1 TIMES FORMAT ‘/Backup01/ARCBAK_%d_%p_%T_%s.rbkp’ TAG           ARCHIVE_BKP;
    BACKUP AS compressed backupset CURRENT CONTROLFILE FORMAT ‘/Backup01/CNT_%d_%p_%T_%s.rbkp’ TAG CONTROL_FILE;
Backup spfile FORMAT ‘/Backup01/SPFILE_%d_%p_%T_%s.rbkp’;
    CROSSCHECK COPY;
    CROSSCHECK BACKUP;
    CROSSCHECK ARCHIVELOG ALL;
    DELETE ARCHIVELOG UNTIL TIME ‘sysdate-4’ BACKED UP 1 TIMES TO DEVICE TYPE DISK;
    DELETE EXPIRED BACKUP;
    DELETE NOPROMPT OBSOLETE;
    DELETE NOPROMPT EXPIRED COPY;
    DELETE NOPROMPT EXPIRED BACKUP;
    DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
}
Copy all backupsets from SERVER1(Location: /data1/bak/TEST/) to SERVER2(Location:/u01/backup/TEST/) , So that we will restore oracle database from cold backup.

ON SERVER2:

–Create pfile for database TEST.


DB Name: TEST

#export ORACLE_SID=TEST

#rman target /

RMAN>startup nomount;

RMAN>restore controlfile from ‘/u01/backup/backup_db_c-300166359-20120316-00’;   — complete path of backup

RMAN>alter database mount;

Since backup location on SERVER2 is different from SERVER1, so we have to use catalog command to update new backup location in control file.

Use below command for all backuppieces:
 
 
RMAN> CATALOG START WITH ‘/my/backup/location’;

Or

RMAN>catalog backuppiece ‘/u01/backup/ora_df_020412_21_14_NSNDB_1635_1’;RMAN>catalog backuppiece ‘/u01/backup/ora_df_020412_21_14_NSNDB_1636_1’;

RMAN>catalog backuppiece ‘/u01/backup/ora_arch_230412_13_43_NSNDB_23_1’;

RMAN>catalog backuppiece ‘/u01/backup/ora_arch_230412_13_43_NSNDB_24_1’;


➨ Since datafile location on SERVER2 is different from SERVER1, so we have to update control file for same with SET NEWNAME clause:


Now restore database backup on SERVER2:

RMAN>
run
{
set newname for datafile ‘/data02/oradata/system01.dbf’ to ‘/u01/oradata/nsnbak/system01.dbf’;
set newname for datafile ‘/data02/oradata/undotbs01.dbf’ to ‘/u01/oradata/nsnbak/undotbs1.dbf’;

set newname for datafile ‘/data02/oradata/sysaux01.dbf’ to ‘/u01/oradata/nsnbak/sysaux01.dbf’;

set newname for datafile ‘/data02/oradata/users01.dbf’ to ‘/u01/oradata/nsnbak/users01.dbf’;

restore database;


switch datafile all;
}

RMAN>exit;

–Also update redo log file in controlfile on SERVER2:

#sqlplus “/as sysdba”

SQL>alter database rename file ‘/data02/oradata/redo07.log’ to ‘/u01/oradata/nsnbak/redo07.log’;
SQL>alter database rename file ‘/data02/oradata/redo08.log’ to ‘/u01/oradata/nsnbak/redo08.log’;

SQL>alter database rename file ‘/data02/oradata//redo09.log’ to ‘/u01/oradata/nsnbak/redo09.log’;

SQL>exit;


#rman target /

RMAN>
run
{
recover database;

alter database open resetlogs; }


RMAN>exit;

#sqlplus “/as sysdba”

SQL>alter database tempfile ‘/u01/home/oracle/PROD/tempfiles/temp01_PROD.dbf’ drop including datafiles;

 

sql>ALTER TABLESPACE TEMP ADD TEMPFILE ‘/u01/oradata/nsnbak/temp01.dbf’ size 200m reuse/size 500M;
 
sql>select name from v$tempfile;
 
 
To change DB name, follow the below steps: –

To change the database name in addition to the DBID, specify the DBNAME parameter. This example changes the name to test_db:
Ensure that the target database is mounted but not open, and that it was shut down consistently prior to mounting. For example:

SHUTDOWN IMMEDIATE
STARTUP MOUNT

$nid TARGET=SYS/password DBNAME=test_db

SQL>ALTER DATABASE OPEN RESETLOGS;

After that modify the parameter file as db_name

6 thoughts on “Restore rman backup to different server with different database name”

  1. I was married at 32 and immediately tried to get pregnant. When I was unable to conceive I had blood tests for fertility and was told that I had an FSH (follicle stimulating hormone) of 54 and would not be able to have children. Even though the doctors knew that I had been diagnosed with Hashimoto’s thyroiditis since age 25, no one bothered to check my thyroid levels. my TSH was measured at .001. My Synthroid dosage was lowered. a friend advise me to contact a spiritualist who help with fertility with his medicine, i collected his contact and explain my situation to him he prepared for me a herbal medicine which i took as describe by him. became pregnant very quickly, I had a successful pregnancy. I have my baby august 2017. to get pregnant at age 35 with my 2nd child in september 2019, thank you sir , this is his email contact if you require his help [email protected] or Facebook at priest.babaka

    Reply
  2. DO YOU NEED A PERSONAL/BUSINESS/INVESTMENT LOAN? CONTACT US TODAY VIA WhatsApp +19292227023 Email [email protected]

    HELLO
    Loan Offer Alert For Everyone! Are you financially down and you need an urgent credit/financial assistance? Or are you in need of a loan to start-up/increase your business or buy your dream house. GET YOUR INSTANT LOAN APPROVAL 100% GUARANTEED TODAY NO MATTER YOUR CREDIT SCORE. WhatsApp:+19292227023 Email: [email protected]

    Reply

Leave a Comment