Home » RDBMS Server » Backup & Recovery » Restore datafile to new location on a new host
Restore datafile to new location on a new host [message #252726] Thu, 19 July 2007 15:28 Go to next message
TLegend33
Messages: 203
Registered: March 2005
Senior Member
RHEL4 Oracle10.2

I am practicing recovery to a new server. I've got the control file restored and the target database mounted. One thing I'm testing is recovering a datafile to a different location on the new server. Below are my commands and output:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> run {
2> allocate channel dev1 type disk;
3> set newname for datafile 1 to '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf';
4> sql "alter database rename file ''/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf'' to ''/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf''";
5> release channel dev1;}

allocated channel: dev1
channel dev1: sid=159 devtype=DISK

executing command: SET NEWNAME

sql statement: alter database rename file ''/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf'' to ''/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf''
released channel: dev1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/19/2007 16:38:55
RMAN-11003: failure during parse/execution of SQL statement: alter database rename file '/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf' to '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf'
ORA-01511: error in renaming log/data files
ORA-01141: error renaming data file 1 - new file '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf' not found
ORA-01110: data file 1: '/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Now, I understand that the errors indicate that the datafiles do not exist in the locations I specified in the name change commands. However, I'm attempting to restore a datafile to a new location on a new host. The only thing I have to work with is my backup piece. Why do I need either datafile to exist if I'm restoring to a new location on a new host?

Thanks.
Re: Restore datafile to new location on a new host [message #252727 is a reply to message #252726] Thu, 19 July 2007 15:33 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
Quote:
Linux-x86_64 Error: 2: No such file or directory


CHECK THE DIRECTORY EXISTINCE.
Check the permission for user.

Quote:
sql "alter database rename file ''/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf'' to ''/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf''"

Replace it with this and try

SWITCH DATAFILE ALL;
Re: Restore datafile to new location on a new host [message #252733 is a reply to message #252727] Thu, 19 July 2007 16:46 Go to previous messageGo to next message
TLegend33
Messages: 203
Registered: March 2005
Senior Member
RMAN> run {
allocate channel dev1 device type disk;
set newname for datafile '/opt/oracle/admin/ESDEV/SYSTEM/ES_DEV.dbf' to '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf';
set newname for datafile '/opt/oracle/admin/ESDEV/SYSAUX/sysaux01.dbf' to '/d6/oradata/ESDEV/SYSTEM/sysaux01.dbf';
switch datafile all;
release channel dev1;}2> 3> 4> 5> 6>

allocated channel: dev1
channel dev1: sid=157 devtype=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

released channel: dev1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch command at 07/19/2007 19:02:59
RMAN-20230: datafile copy not found in the recovery catalog
RMAN-06015: error while looking up datafile copy name: /d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf

Yes, the directories exist. The user (oracle) has ownership and permissions on the directories. Do I need to include the name of my backup piece somewhere in my syntax? The
RMAN-06015: error while looking up datafile copy name: /d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf
leads me to believe that rman is looking in the wrong place.
Re: Restore datafile to new location on a new host [message #252734 is a reply to message #252733] Thu, 19 July 2007 17:04 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
Yes you should tell it the restore operation like this

Quote:
RUN
{
SET NEWNAME FOR TEMPFILE 1 TO '/newdisk/dbs/temp1.f';
SET NEWNAME FOR TEMPFILE 2 TO '/newdisk/dbs/temp2.f';
SET NEWNAME FOR TEMPFILE 3 TO NEW; #use OMF for this one
SWITCH TEMPFILE ALL;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN;
}


RUN
{  
  ALLOCATE CHANNEL dev1 DEVICE TYPE DISK;  
  ALLOCATE CHANNEL dev2 DEVICE TYPE sbt;  
  SQL "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE";  
  SET NEWNAME FOR DATAFILE '/disk7/oracle/tbs11.f' 
    TO '/disk9/oracle/tbs11.f';  
  RESTORE TABLESPACE tbs_1; 
  SWITCH DATAFILE ALL;  
  RECOVER TABLESPACE tbs_1;  
  SQL "ALTER TABLESPACE tbs_1 ONLINE";  
}

[Updated on: Thu, 19 July 2007 17:06]

Report message to a moderator

Re: Restore datafile to new location on a new host [message #252735 is a reply to message #252734] Thu, 19 July 2007 17:47 Go to previous messageGo to next message
TLegend33
Messages: 203
Registered: March 2005
Senior Member
How can I "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE" when the database is in a mount state?
Re: Restore datafile to new location on a new host [message #252736 is a reply to message #252735] Thu, 19 July 2007 17:53 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
try this command.

run {
2> allocate channel dev1 type disk;
3> set newname for datafile 1 to '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf';
RESTORE DATABASE;
SWITCH DATAFILE ALL;
RECOVER DATABASE

[Updated on: Thu, 19 July 2007 18:10]

Report message to a moderator

Re: Restore datafile to new location on a new host [message #252760 is a reply to message #252733] Thu, 19 July 2007 21:53 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
You may try setting the following prior to restoring:

RMAN> configure auxname for datafile 1 to '/d6/oradata/ESDEV/SYSTEM/ES_DEV.dbf';

Previous Topic: Setting Environment Variable in RMAN scripts
Next Topic: Duplicate DB on another host using different paths
Goto Forum:
  


Current Time: Fri Dec 09 08:05:39 CST 2016

Total time taken to generate the page: 0.10607 seconds