This content has been marked as final. Show 19 replies
If I understand your question correctly then you can use set newname for datafile and switch datafile all to change the restore location. For example,
set newname for datafile 'c:\oracle\backup\system01.dbf' to 'd:\oracle\backup\system01.dbf'
# insert the rest of your datafiles here
switch datafile all;
Thanks for the reply.
That's exactly what I did in my last test restore to the aforementioned "third server" and it worked. We had to use "set newname" because the source of the backup was ASM and the destination was a filesystem.
My question though is how does oracle know where the backup files are located? When I put the .bus files on the destination server and initiate the restore, how does it know where to look for them? Does oracle search the filesystem for the .bus files?
Oracle maintains that information in the control file.
I'm sorry but I'm not a hundred percent sure on that one. I'm not even really sure what a .bus file is in regards to RMAN and Oracle. The control file does keep record of your backups in the original location that they were backed up. If you want to add backups to your control file (or recovery catalog) you can always use the catalog command. For example,
catalog datafilecopy 'c:\oracle\backup\userfile01.dbf';
catalog archivelog 'c:\oracle\backup\arc1.log';
catalog controlfilecopy 'c:\oracle\backup\ctfilecopy.ctl';
Sorry I couldn't be more help. Does anybody else have a solution?
That's correct. If the OP is using a recovery catalog the information would be stored in the control file (potentially limited by CONTROL_FILE_RECORD_KEEP_TIME) and the recovery catalog.
CATALOGing backup pieces became available in 10G.
I believe the .bus file is the extension the OP is giving his/her backup pieces.
Not to throw another variable in, but I'm not using the RMAN catalog. And the last poster is correct, .bus just happens to be how my predecessor set up the backups. Not sure where that logic came from.
Any other suggestions? Thanks a bunch...
You don't need to use the recovery catalog. You could still use the previous commands with a control file (assuming that you are using 10g, according to ebrian).
So there's no speculation, here's the process I've used.
1. Place backup files on destination server, including controlfile and datafiles.
2. RMAN> startup nomount;
3. RMAN> set DBID = <DBID>
4. RMAN> restore controlfile from autobackup;
5. RMAN> alter database mount;
6. RMAN> rename files, restore database, switch files, recover database, all done by script...
7. RMAN> alter database open;
The process works, I'd just like to know how it finds the datafiles. I've been told they could be located anywhere, so how it's supposed to work is still a mystery, atleast to me.
You say you are renaming the files in a script. Are you specifying the datafile locations when you are renaming?
Yes indeed. Here's the script:
set newname for datafile 1 to '/opt/oracle/product/10gR2/oradata/DB01/system.dbf';
set newname for datafile 2 to '/opt/oracle/product/10gR2/oradata/DB01/undotbs1.dbf';
set newname for datafile 3 to '/opt/oracle/product/10gR2/oradata/DB01/sysaux.dbf';
set newname for datafile 4 to '/opt/oracle/product/10gR2/oradata/DB01/users.dbf';
set newname for datafile 5 to '/opt/oracle/product/10gR2/oradata/DB01/undotbs2.dbf';
set newname for datafile 6 to '/opt/oracle/product/10gR2/oradata/DB01/file1.dbf';
set newname for datafile 7 to '/opt/oracle/product/10gR2/oradata/DB01/file2.dbf';
switch datafile all;
Okay, so you are saying you moved your backup files from server1 to a completely different directory on server2. Then you restored and somehow RMAN was able to find your backup files. Yep, I don't see how that would work.
I know that when you use restore controlfile from autobackup RMAN looks in the default location for the control file backukp (probably the FRA). Is it possible RMAN is loading some past control file and you are actually restoring some other backups? Just a shot in the dark, beyond that I'm not really sure.
Just curious, are you copying all these files from the FRA on server1 to the FRA on server2?
Sorry if I'm not being clear. Server 1 is the original server. Server 2 is the final destination for the database, and server 3 is where I'm doing my testing.
The files that are being restored from are in a tar file FTP'd from Server 1 on a nightly basis. The file structure in the tar file is /ocfs2/oracleBackups/tmp, and it contains the controlfile and 3 datafiles. Since it was a tar file, I'm sure this is where the files reside on Server 1 before we purge them.
When I extracted the tar file to root (/) on Server 3, it kept the same file structure (/ocfs2/oracleBackups/tmp/). The FRA on Server 3 is /opt/oracle/product/10gR2/db/flash_recovery_area/, and I didn't place any files in it to do the restore. Prior to the restore of the controlfile, I placed it (only the controlfile) in /opt/oracle/product/10gR2/db/dbs . This is where RMAN found it without specifying it explicitly.
Oh, okay well here are some rules on how RMAN searches for the control file when you use restore controlfile from autobackup. Basically if you don't set the options below RMAN searches in $ORACLE_HOME/dbs which looks like what is happening in your case.
220.127.116.11 Default Destination for Restore of the Control File
When restoring the control file, the default destination is all of the locations defined in the CONTROL_FILES initialization parameter. If you do not set the CONTROL_FILES initialization parameter, the database uses the same rules to determine the destination for the restored control file as it uses when creating a control file if the CONTROL_FILES parameter is not set. These rules are described in Oracle Database SQL Reference in the description of the CREATE CONTROLFILE statement.
And the Oracle Database SQL Reference from http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5003.htm#SQLRF01203 says
When you issue a CREATE CONTROLFILE statement, Oracle Database creates a new control file based on the information you specify in the statement. The control file resides in the location specified in the CONTROL_FILES initialization parameter. If that parameter does not have a value, then the database creates an Oracle-managed control file in the default control file destination, which is one of the following (in order of precedence):
• One or more control files as specified in the DB_CREATE_ONLINE_LOG_DEST_n initialization parameter. The file in the first directory is the primary control file. When DB_CREATE_ONLINE_LOG_DEST_n is specified, the database does not create a control file in DB_CREATE_FILE_DEST or in DB_RECOVERY_FILE_DEST (the flash recovery area).
• If no value is specified for DB_CREATE_ONLINE_LOG_DEST_n, but values are set for both the DB_CREATE_FILE_DEST and DB_RECOVERY_FILE_DEST, then the database creates one control file in each location. The location specified in DB_CREATE_FILE_DEST is the primary control file.
• If a value is specified only for DB_CREATE_FILE_DEST, then the database creates one control file in that location.
• If a value is specified only for DB_RECOVERY_FILE_DEST, then the database creates one control file in that location.
If no values are set for any of these parameters, then the database creates a control file in the default location for the operating system on which the database is running. This control file is not an Oracle-managed file.
Thanks 8202 for the reply. The info you provided fills in some gaps. Greatly appreciated.
Unfortunately it doesn't explain where RMAN finds the datafiles to restore.
This morning I copied the restore files from their original extracted location to the /dbs folder with the controlfile I want to restore, and deleted the originals where tar put them. No copies besides in the dbs dir exist. It did find the controlfile, but when restoring the DB RMAN says:
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
I placed the restore files in the flash recovery area, again, no luck. So far RMAN has only found the restore files when I've put them in that extracted path. I still have to believe though that there's a way to tell RMAN where to look for the restore files, not just the controlfile. Not having luck finding the syntax to do so.