RMAN> run{
2> set newname for datafile '/u01/app/oracle/oradata/oracle/system01.dbf' to '/u02/backup/system01.dbf';
3> set newname for datafile '/u01/app/oracle/oradata/oracle/sysaux01.dbf' to '/u02/backup/sysaux01.dbf';
4> set newname for datafile '/u01/app/oracle/oradata/oracle/undotbs01.dbf' to '/u02/backup/undotbs01.dbf';
5> set newname for datafile '/u01/app/oracle/oradata/oracle/users01.dbf' to '/u02/backup/users01.dbf';
6> set newname for datafile '/u01/app/oracle/oradata/oracle/example01.dbf' to '/u02/backup/example01.dbf';
7> restore database;
8> switch datafile all;
9> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 21-JUN-17
Starting implicit crosscheck backup at 21-JUN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
Crosschecked 11 objects
Finished implicit crosscheck backup at 21-JUN-17
Starting implicit crosscheck copy at 21-JUN-17
using channel ORA_DISK_1
Finished implicit crosscheck copy at 21-JUN-17
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ORACLE/autobackup/2017_06_21/o1_mf_s_947205887_dnln7zj8_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORACLE/autobackup/2017_06_21/o1_mf_s_947203784_dnll6f7t_.bkp
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/21/2017 04:45:53
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 5 found to 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
RMAN>
分析:因为备份位置不一致需要统一路径,运用catalog执行下,再运行run块。
RMAN> catalog start with "/u02/backup";
searching for all files that match the pattern /u02/backup
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u02/backup/db_1ns7alvg_1_1.bak
File Name: /u02/backup/o1_mf_s_947214406_dnlwl7d5_.bkp
File Name: /u02/backup/arch_1os7am25_1_1.bak
File Name: /u02/backup/arch_1ms7alv0_1_1.bak
List of Files Which Where Not Cataloged
=======================================
File Name: /u02/backup/adump/oracle_ora_2576_20170621043926339109143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2597_20170621044532423158143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2529_20170621043859694415143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2568_20170621043859718900143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2600_20170621044551359424143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2580_20170621043935788495143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/sztech1_ora_2284_20170621042756065330143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2524_20170621043825204198143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2596_20170621044532390476143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2579_20170621043935597095143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/sztech1_ora_2323_20170621042756112885143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2577_20170621043926378574143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_8648_20170621034533026473143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2484_20170621043825161565143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2595_20170621044532352386143795.aud
RMAN-07517: Reason: The file header is corrupted
File Name: /u02/backup/adump/oracle_ora_2578_20170621043926419888143795.aud
RMAN-07517: Reason: The file header is corrupted
RMAN>
再次恢复数据库run块
RMAN> run{
2> set newname for datafile '/u01/app/oracle/oradata/oracle/system01.dbf' to '/u02/backup/system01.dbf';
3> set newname for datafile '/u01/app/oracle/oradata/oracle/sysaux01.dbf' to '/u02/backup/sysaux01.dbf';
4> set newname for datafile '/u01/app/oracle/oradata/oracle/undotbs01.dbf' to '/u02/backup/undotbs01.dbf';
5> set newname for datafile '/u01/app/oracle/oradata/oracle/users01.dbf' to '/u02/backup/users01.dbf';
6> set newname for datafile '/u01/app/oracle/oradata/oracle/example01.dbf' to '/u02/backup/example01.dbf';
7> restore database;
8> switch datafile all;
9> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 21-JUN-17
using channel ORA_DISK_1
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 /u02/backup/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u02/backup/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u02/backup/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u02/backup/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u02/backup/example01.dbf
channel ORA_DISK_1: reading from backup piece /u02/backup/db_1ns7alvg_1_1.bak
channel ORA_DISK_1: piece handle=/u02/backup/db_1ns7alvg_1_1.bak tag=TAG20170621T030520
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 21-JUN-17