标题: 异机恢复 RMAN-06023: no backup or copy of datafile ## found to restore [打印本页] 作者: 王亮 时间: 2020-11-12 17:04 标题: 异机恢复 RMAN-06023: no backup or copy of datafile ## found to restore 因搭建测试库,使用原库的本地RMAN备份,进行RMAN异机恢复,出现RMAN-06023错误。
具体过程如下:
先拷贝原库的口令文件和参数文件到备库。
然后使用如下脚本对原库进行备份:
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
backup full database format'c:\rmanbak\date%Y%m%d_full_%d_%s_%p_%u.bak'
tag='full' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format'c:\rmanbak\date%Y%m%d_archivelog_%d_%s_%p_%u.bak' delete all input;
release channel d2;
release channel d1;
}
备份完成后把这些备份文件全部拷到备库中已经事先创建好的目录C:\rmanbak\,注意一定要拷全。
由于我异机恢复的时候的数据文件是和原库不同的目录所以在恢复时使用如下的脚本:
run{
set newname for datafile 1 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\SYSTEM01.DBF";
set newname for datafile 2 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\UNDOTBS01.DBF";
set newname for datafile 3 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\SYSAUX01.DBF";
set newname for datafile 4 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\USERS01.DBF";
set newname for datafile 5 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\OEEDATA.DBF";
set newname for datafile 6 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\OEEINDEX.DBF";
set newname for datafile 7 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\SMLDATA.DBF";
set newname for datafile 8 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\SMLINDX.DBF";
set newname for datafile 9 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\MEDDATA.DBF";
set newname for datafile 10 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\MEDINDX.DBF";
set newname for datafile 11 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\LRGDATA.DBF";
set newname for datafile 12 to"C:\ORACLE\PRODUCT\11.2.0\ORADATA\ORCL\LRGINDX.DBF";