《Dataguard Concepts and Administration》文档中12.9.3 Standby Database File Names Are Different From Primary Database
有描述对文件名不同时的处理情况
SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/cdr1/orcl/system01.dbf /u01/app/oracle/oradata/cdr1/orcl/sysaux01.dbf /u01/app/oracle/oradata/cdr1/orcl/undotbs01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdbseed/system01.dbf /u01/app/oracle/oradata/cdr1/orcl/users01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdbseed/sysaux01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdborcl/system01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdborcl/sysaux01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdborcl/example01.dbf /u01/app/oracle/oradata/cdr1/orcl/pdborcl/soe01 NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/cdr1/orcl/ex1.dbf /u01/app/oracle/oradata/cdr1/orcl/soe.dbf 13 rows selected.
使用下面的脚本进行恢复
RUN { SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf'; SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/pdbseed/system01.dbf'; SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/users01.dbf'; SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 8 TO '/u01/app/oracle/oradata/orcl/pdborcl/system01.dbf'; SET NEWNAME FOR DATAFILE 9 TO '/u01/app/oracle/oradata/orcl/pdborcl/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 10 TO '/u01/app/oracle/oradata/orcl/pdborcl/SAMPLE_SCHEMA_users01.dbf'; SET NEWNAME FOR DATAFILE 11 TO '/u01/app/oracle/oradata/orcl/pdborcl/example01.dbf'; SET NEWNAME FOR DATAFILE 12 TO '/u01/app/oracle/oradata/orcl/pdborcl/soe01'; SET NEWNAME FOR DATAFILE 13 TO '/u01/app/oracle/oradata/orcl/ex1.dbf'; SET NEWNAME FOR DATAFILE 14 TO '/u01/app/oracle/oradata/orcl/soe.dbf'; RESTORE DATABASE; SWITCH DATAFILE ALL; RECOVER DATABASE NOREDO; }
出错
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 09/04/2020 11:52:34 RMAN-06026: some targets not found - aborting restore RMAN-06100: no channel to restore a backup or copy of datafile 4
undo表空间不能这样恢复,直接拷贝。