19 | 03 | 2024
Latest Articles
Popular Articles

RMAN

How to restore an RMAN cold backup on a new server. ( same OS, same Oracle version )

User Rating:  / 7
PoorBest 

How to restore an RMAN cold backup on a new server. ( same OS, same Oracle version )

 


See also How to backup with the keep option and restore without a recovery catalog

See also How to restore an SPFILE and RMAN cold backup on a new server. ( same OS, same Oracle version )

See also How to restore and RMAN backup from TAG

 

You have to restore your database from scratch to a new server with a new Oracle Home, your old database is not available anymore.

I had a similar situation today. A server with hostname X was going to be replaced by another server with the same hostname X.
At the moment I had to restore the database on the new server the old server was not available anymore so the duplicate target database technology was not possible. I had planned downtime of a few hours.


Prior to the shutdown of the old database server I made a cold backup and I installed the same Oracle version on the same OS on the new database server ( requirement ). I had the good luck to have the same filesystem for both datafiles and rman backup pieces ( which were made on disk )



STEP 1 : The server parameter file

I copy passwordfile and server parameter file into the new $ORACLE_HOME/dbs

 

oracle@myhost ~$ cp spfilePLATINUM.ora $ORACLE_HOME/dbs
oracle@myhost ~$ cp orapwPLATINUM $ORACLE_HOME/dbs



I create an ascii file from the server parameter file and have some adjustements made and validations done ( like user_dump_dest ... )

oracle@myhost dbs$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Jul 1 12:31:15 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> create pfile from spfile;

File created.

SQL> exit
Disconnected

oracle@myhost dbs$ ls -ltr
total 40
-rw-r-----  1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r--r--  1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r-----  1 oracle oinstall  3584 Jul  1 12:30 spfilePLATINUM.ora
-rw-r-----  1 oracle oinstall  1536 Jul  1 12:30 orapwPLATINUM
-rw-r--r--  1 oracle oinstall  1097 Jul  1 12:31 initPLATINUM.ora

oracle@myhost dbs$ vi initPLATINUM.ora -- ( and I adjust the parameters )


STEP 2 : startup nomount

 

Startup nomount since I haven' t a control file yet. 


oracle@myhost dbs $ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Jul 1 12:33:57 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1895825408 bytes
Fixed Size                  2073632 bytes
Variable Size             436210656 bytes
Database Buffers         1442840576 bytes
Redo Buffers               14700544 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

 

STEP 3 : RESTORE CONTROL FILES

 

I connect with RMAN, set the right dbid and restore the controlfiles. 

 

oracle@myhost dbs$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Wed Jul 1 12:34:56 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: PLATINUM (not mounted)


RMAN> set dbid 706111982;

executing command: SET DBID

RMAN> restore controlfile from '/u01/backup/CT_4bkisua9_1_1';

Starting restore at 01-JUL-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=321 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/u01/oradata/PLATINUM/control01.ctl
output filename=/u01/oradata/PLATINUM/control02.ctl
output filename=/u01/oradata/PLATINUM/control03.ctl
Finished restore at 01-JUL-09

 

STEP 4 : MOUNT THE DATABASE

 

Once the control files are restored I can mount the database.

 

RMAN> sql "alter database mount";

sql statement: alter database mount
released channel: ORA_DISK_1


STEP 5 : VERIFICATION AVAILABILITY OF BACKUP


Now I validate whether the backups known in the controlfile are there. remember that I restored the lastest backups to exactly the same location.

I use the rman below RMAN command' s

 

RMAN > list backup summary; --- which backups should have been made and are logically known in the control file ? 

RMAN > list backup TAG='xyz' --- Is this the backup i would like to restore ?

RMAN > crosscheck backup TAG='xyz' --- is this backup available ?



RMAN > list backup summary;

output not posted

RMAN > list backup TAG='TAG20090630T154910';

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time


137     Full    115.50M    DISK        00:00:48     30-JUN-09
        BP Key: 137   Status: AVAILABLE  Compressed: YES  Tag: TAG20090630T154910
        Piece Name: /u01/backup/db_49kisu3m_1_1

  List of Datafiles in backup set 137

  File LV Type Ckp SCN    Ckp Time  Name
  ---- — ---- ---------- --------- ----
  1       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/system01.dbf
  2       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/undotbs01.dbf
  3       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/sysaux01.dbf
  4       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/users01.dbf
  5       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/silver.dbf
  6       Full 2108954    30-JUN-09 /u01/oradata/PLATINUM/gold.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time


138     Full    1.06M      DISK        00:00:01     30-JUN-09        

BP Key: 138   Status: AVAILABLE  Compressed: YES 

Tag: TAG20090630T154910         Piece Name: /u01/backup/db_4akisu5e_1_1  

Control File Included: Ckp SCN: 2108954      Ckp time: 30-JUN-09  

SPFILE Included: Modification time: 30-JUN-09

RMAN > crosscheck backup TAG='TAG20090630T154910';

output not posted

 

STEP 6 : RESTORE THE BACKUP

 

I restore the lastest backup. Since it concerns a cold backup I do not have to recover it, it is consistent.

 

RMAN> restore database from TAG='TAG20090630T154910' 

Starting restore at 01-JUL-09 

using channel ORA_DISK_1 channel ORA_DISK_1:

starting datafile backupset restore channel ORA_DISK_1:

specifying datafile(s) to restore from backup set 

restoring datafile 00001 to /u01/oradata/PLATINUM/system01.dbf 

restoring datafile 00002 to /u01/oradata/PLATINUM/undotbs01.dbf 

restoring datafile 00003 to /u01/oradata/PLATINUM/sysaux01.dbf 

restoring datafile 00004 to /u01/oradata/PLATINUM/users01.dbf 

restoring datafile 00005 to /u01/oradata/PLATINUM/silver.dbf 

restoring datafile 00006 to /u01/oradata/PLATINUM/gold.dbf 

channel ORA_DISK_1: reading from backup piece /u01/backup/db_49kisu3m_1_1 channel

ORA_DISK_1: restored backup piece 1 piece handle=/u01/backup/db_49kisu3m_1_1 tag=TAG20090630T154910 

channel ORA_DISK_1: restore complete, elapsed time: 00:00:56 

Finished restore at 01-JUL-09

 

STEP 7 : OPEN THE DATABSE WITH RESETLOGS

 

RMAN> sql "alter database open resetlogs";

sql statement: alter database open resetlogs

 

STEP 8 :  MANAGE LISTENER.ORA, TNSNAMES.ORA and passwordfile

 

I moved the tnsnames.ora and listener into the new $ORACLE_HOME/network/admin



oracle@myhost ~ $ cp tnsnames.ora $ORACLE_HOME/network/admin

oracle@myhost ~ $ cp listener.ora $ORACLE_HOME/network/admin

oracle@myhost ~ $ cp orapwPLATINUM $ORACLE_HOME/dbs