How to change the path of temp file,redo log file when restore an rman backup on another machine

oracleoracle-11g-r2rman

I am trying to migrate my database (11.2.0.4) A to another machine by using rman backup. At present, in the source machine, the redo log file, temp file is stored under the directory foo (/foo). In the target machine, I would like to store these files under the directory bar (/bar).
In the past practice, what I did is to create foo for these files and move these files to bar manually after the recovery is complete. RMAN is such a powerful tool that I think there must be some an easy way to satisfy my requirement.
So far, by searching the google, I got a useful rman command for temp file:

set newname for tempfile <fileno> to '<path>'

It seems that there is no similar command for redo file.
Before using this command to perform a recovery, I have several questions to ask:

  1. When we take an full backup, the backup did not go with temp tablespace and redo files, but in the past migration I experienced, I found that when I open (alter database open resetlogs)the database after recovery is complete, redo log files and temp files exist. Will rman create this automatically for database? I can`t find the reliable oracle documents for this topic.
  2. To change the path for redo is so boring, I would the finish this task in the rman scripts, is there any command available to rename the redo log file in the rman scripts?

Best Answer

You can either use a pfile and set the following in the pfile, or you can use an spfile and do a startup nomount to set the following variables. You can have as many directories as you want the pattern will still be: '','','','','',''...

alter system set db_file_name_convert='/foo/','/bar/' scope=spfile;
alter system set log_file_name_convert='/foo/','/bar/' scope=spfile;

You can also specify the redo on the clone/restore command.

DUPLICATE DATABASE TO mytest BACKUP LOCATION '/mybackup/mytest' 
LOGFILE 
       GROUP 1 ('/mybackup/mytest/redo01a.log',  '/mybackup/mytest/redo01b.log') SIZE 256M REUSE,
       GROUP 2 ('/mybackup/mytest/redo02a.log',  '/mybackup/mytest/redo02b.log') SIZE 256M REUSE,
       GROUP 3 ('/mybackup/mytest/redo03a.log',  '/mybackup/mytest/redo03b.log') SIZE 256M REUSE  
NOFILENAMECHECK;