错误背景:作为菜了开始进行恢复的时候我不知道如果没有指定恢复路径,恢复会按备份的控制文件中记录的原数据库的存放路径进行恢复。所以当原数据库结构和目标数据库结构不一样的时候就会犯和我一样的错误。错误信息如下:MAN> RESTORE DATABASE;
Starting restore at 07-JAN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=2190 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/db/Oracle/oradata/ecdsdb/rsystem_01_4g
restoring datafile 00002 to /home/db/oracle/oradata/ecdsdb/rundotbs1_01_10g
restoring datafile 00004 to /home/db/oracle/oradata/ecdsdb/ruser_01_512m
restoring datafile 00006 to /home/db/oracle/oradata/ecdsdb/rtbs_data1_01_16g
restoring datafile 00008 to /home/db/oracle/oradata/ecdsdb/rtbs_part_01_16g
channel ORA_DISK_1: reading from backup piece /home/orarch_ecdsdb2/20121218/pri_ECDSDB_30527_1.bk
ORA-19870: error reading backup piece /home/orarch_ecdsdb2/20121218/pri_ECDSDB_30527_1.bk
ORA-19504: failed to create file "/home/db/oracle/oradata/ecdsdb/rtbs_data1_01_16g"
ORA-27040: file create error, unable to create file
HPUX-ia64 Error: 2: No such file or directory
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /home/db/oracle/oradata/ecdsdb/rsysaux_01_4g
restoring datafile 00005 to /home/db/oracle/oradata/ecdsdb/rundotbs2_01_10g
restoring datafile 00007 to /home/db/oracle/oradata/ecdsdb/rtbs_data2_01_24g
restoring datafile 00009 to /home/db/oracle/oradata/ecdsdb/rtbs_idx1_01_16g
restoring datafile 00010 to /home/db/oracle/oradata/ecdsdb/rpatrol_data_01_256m
channel ORA_DISK_1: reading from backup piece /home/orarch_ecdsdb2/20121218/pri_ECDSDB_30526_1.bk
ORA-19870: error reading backup piece /home/orarch_ecdsdb2/20121218/pri_ECDSDB_30526_1.bk
ORA-19504: failed to create file "/home/db/oracle/oradata/ecdsdb/rtbs_data2_01_24g"
ORA-27040: file create error, unable to create file
HPUX-ia64 Error: 2: No such file or directory
failover to previous backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/07/2013 13:07:37
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 10
RMAN-06100: no channel to restore a backup or copy of datafile 9
RMAN-06100: no channel to restore a backup or copy of datafile 8
RMAN-06100: no channel to restore a backup or copy of datafile 7
RMAN-06100: no channel to restore a backup or copy of datafile 6
RMAN-06100: no channel to restore a backup or copy of datafile 5
RMAN-06100: no channel to restore a backup or copy of datafile 4
RMAN-06100: no channel to restore a backup or copy of datafile 3
RMAN-06100: no channel to restore a backup or copy of datafile 2
RMAN-06100: no channel to restore a backup or copy of datafile 1
报如上错误,说明控制文件中记录了目标数据库的数据库文件路径和本地的/home/oracle/oradata/ecdsdb/不同,所以必须重新指向数据文件的位置如下操作。
解决方法:RMAN> run{
2> set newname for datafile 1 to '/home/oracle/oradata/ecdsdb/system_01_4g';
3> set newname for datafile 2 to '/home/oracle/oradata/ecdsdb/undotbs1_01_10g';
4> set newname for datafile 4 to '/home/oracle/oradata/ecdsdb/user_01_512m';
5> set newname for datafile 6 to '/home/oracle/oradata/ecdsdb/tbs_data1_01_16g';
6> set newname for datafile 8 to '/home/oracle/oradata/ecdsdb/tbs_part_01_16g';
7> set newname for datafile 3 to '/home/doracle/oradata/ecdsdb/sysaux_01_4g';
8> set newname for datafile 5 to '/home/oracle/oradata/ecdsdb/undotbs2_01_10g';
9> set newname for datafile 7 to '/home/oracle/oradata/ecdsdb/tbs_data2_01_24g';
10> set newname for datafile 9 to '/home/oracle/oradata/ecdsdb/tbs_idx1_01_16g';
11> set newname for datafile 10 to '/home/oracle/oradata/ecdsdb/patrol_data_01_256m';
12> restore database;
13> }
