Version : 11.2.0.3 on Linux
Today I had to do a RMAN restore to a new server and I came across the following OTN post on SET NEWNAME FOR DATABASE
2416124
So, I thought of using it for pointing the new location of the datafiles to restore.
This is what I did
===================
Restored the control file and cataloged the backup pieces using CATALOG START WITH command. Then I started restore
$ rman target / cmdfile=restore.txt
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jul 26 04:40:41 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: SPIKEY (DBID=2576163333, not open)
RMAN> run
2> {
3> SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey';
4> restore database ;
5> }
6>
7>
8>
executing command: SET NEWNAME
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 07/26/2012 04:40:43
RMAN-06970: NEWNAME '/fnup/hwrc/oradata/spikey' for database must include %f or %U format
Recovery Manager complete.
Don't know how it worked for Levi without %f or %U . So , I added %f
$ vi restore.txt
$ cat restore.txt
run
{
SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey/%f';
restore database ;
}
$ rman target / cmdfile=restore.txt
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jul 26 04:45:45 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: SPIKEY (DBID=2576163333, not open)
RMAN> run
2> {
3> SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey/%f';
4> restore database ;
5> }
6>
7>
8>
executing command: SET NEWNAME
Starting restore at 26-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /fnup/hwrc/oradata/spikey/1
channel ORA_DISK_1: restoring datafile 00002 to /fnup/hwrc/oradata/spikey/2
channel ORA_DISK_1: restoring datafile 00003 to /fnup/hwrc/oradata/spikey/3
channel ORA_DISK_1: restoring datafile 00004 to /fnup/hwrc/oradata/spikey/4
channel ORA_DISK_1: restoring datafile 00005 to /fnup/hwrc/oradata/spikey/5
channel ORA_DISK_1: restoring datafile 00006 to /fnup/hwrc/oradata/spikey/6
channel ORA_DISK_1: restoring datafile 00007 to /fnup/hwrc/oradata/spikey/7
channel ORA_DISK_1: restoring datafile 00008 to /fnup/hwrc/oradata/spikey/8
channel ORA_DISK_1: restoring datafile 00009 to /fnup/hwrc/oradata/spikey/9
channel ORA_DISK_1: reading from backup piece /u07/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk
channel ORA_DISK_1: errors found reading piece handle=/u07/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk
channel ORA_DISK_1: failover to piece handle=/u07/dump/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk tag=SPIKEY_FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:56
Finished restore at 26-JUL-12
Recovery Manager complete.
As you can see, RMAN restored the datafiles to desired location. But the datafile names ended up as
1
2
3
.
.
.
9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -----------| Holy Cow |-----------------------------
So I had to rename each file like below
$ mv 1 /fnup/hwrc/oradata/spikey/system01.dbf
$ mv 2 /fnup/hwrc/oradata/spikey/sysaux01.dbf
$ mv 3 /fnup/hwrc/oradata/spikey/undotbs01.dbf
I would have been better off executing the below command for each datafile
SET NEWNAME FOR DATAFILE
Now I am thinking , there is no advantage in using SET NEWNAME FOR DATABASE TO . Only disadvantages. Did I do anything wrong above ?