17 | 10 | 2017
Latest Articles
Popular Articles

RMAN

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

User Rating:  / 1
PoorBest 

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

 

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

 

You have to restore your database from scratch to a new server 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.


I made a cold backup and installed the same Oracle version on the same OS ( requirement )
I had the good luck to have the same filesystem for both datafiles and rman backup pieces ( which were made on disk )


I copy passwordfile into the new $ORACLE_HOME/dbs

 

[oracle@pcguy ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 6 09:28:13 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)


RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/11.2.0/dbhome_1/dbs/initSILVER.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     158662656 bytes

Fixed Size                     2226456 bytes
Variable Size                104859368 bytes
Database Buffers              46137344 bytes
Redo Buffers                   5439488 bytes

RMAN> restore spfile from '/opt/flash_recovery_area/backup/SILVER/SP_SILVER_65n00dpa_1_1';

Starting restore at 06-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /opt/flash_recovery_area/backup/SILVER/SP_SILVER_65n00dpa_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 06-JAN-12

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area     626327552 bytes

Fixed Size                     2230952 bytes
Variable Size                478152024 bytes
Database Buffers             138412032 bytes
Redo Buffers                   7532544 bytes

 

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area     626327552 bytes

Fixed Size                     2230952 bytes
Variable Size                478152024 bytes
Database Buffers             138412032 bytes
Redo Buffers                   7532544 bytes


RMAN> set dbid 2121303953;

executing command: SET DBID

RMAN> restore controlfile from '/opt/flash_recovery_area/backup/SILVER/CT_SILVER_64n00dp8_1_1';

Starting restore at 06-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/opt/oradata/SILVER/control01.ctl
output file name=/opt/flash_recovery_area/SILVER/control02.ctl
Finished restore at 06-JAN-12

 
RMAN> sql "alter database mount";

sql statement: alter database mount
released channel: ORA_DISK_1



[oracle@pcguy SILVER]$ rm con*
[oracle@pcguy SILVER]$ cd /opt/oradata
[oracle@pcguy oradata]$ ls
[oracle@pcguy oradata]$ mkdir SILVER


RMAN> run {
2> allocate channel ch1 device type disk;
3> allocate channel ch2 device type disk;
4> restore database;
5> }

allocated channel: ch1
channel ch1: SID=11 device type=DISK

allocated channel: ch2
channel ch2: SID=136 device type=DISK

Starting restore at 06-JAN-12
Starting implicit crosscheck backup at 06-JAN-12
Crosschecked 2 objects
Crosschecked 24 objects
Finished implicit crosscheck backup at 06-JAN-12

Starting implicit crosscheck copy at 06-JAN-12
Crosschecked 2 objects
Finished implicit crosscheck copy at 06-JAN-12

searching for all files in the recovery area
cataloging files...
no files cataloged


channel ch1: starting datafile backup set restore
channel ch1: specifying datafile(s) to restore from backup set
channel ch1: restoring datafile 00001 to /opt/oradata/SILVER/system01.dbf
channel ch1: restoring datafile 00003 to /opt/oradata/SILVER/undotbs01.dbf
channel ch1: reading from backup piece /opt/flash_recovery_area/backup/SILVER/DB_SILVER_61n00dg0_1_1
channel ch2: starting datafile backup set restore
channel ch2: specifying datafile(s) to restore from backup set
channel ch2: restoring datafile 00002 to /opt/oradata/SILVER/sysaux01.dbf
channel ch2: restoring datafile 00004 to /opt/oradata/SILVER/users01.dbf
channel ch2: reading from backup piece /opt/flash_recovery_area/backup/SILVER/DB_SILVER_60n00dg0_1_1
channel ch1: piece handle=/opt/flash_recovery_area/backup/SILVER/DB_SILVER_61n00dg0_1_1 tag=TAG20120105T112240
channel ch1: restored backup piece 1
channel ch1: restore complete, elapsed time: 00:01:45
channel ch2: piece handle=/opt/flash_recovery_area/backup/SILVER/DB_SILVER_60n00dg0_1_1 tag=TAG20120105T112240
channel ch2: restored backup piece 1
channel ch2: restore complete, elapsed time: 00:04:45
Finished restore at 06-JAN-12
released channel: ch1
released channel: ch2

RMAN> sql "alter database open resetlogs";

sql statement: alter database open resetlogs

 

or when we replace the Oracle version with a more recent one ( note the upgrade itself is not documented here )


RMAN> sql "alter database open resetlogs upgrade";

sql statement: alter database open resetlogs upgrade