oracle 19c搭建过程过程中,执行duplicate报错,具体如下:
RMAN>duplicate target database for standby from active database nofilenamecheck;
input datafile file number=00001 name=/data/u01/app/oracle/oradata/BHDB/system01.dbf
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/26/2020 16:12:35
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""
channel ORA_DISK_1 disabled, job failed on it will be run on another channel
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/26/2020 16:12:35
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/26/2020 16:12:35
ORA-17628: Oracle error 19505 returned by remote Oracle server
ORA-19505: failed to identify file ""
问题原因:
一般遇到这个问题,都是参数db_file_name_convert和log_file_name_convert设置的转换路径的问题,可以检查下从库的相关目录是否存在以及是否有权限!
环境介绍:
主库的数据文件为如下所示,主要涉及到三个目录:
/data/u01/app/oracle/oradata/BHDB/system01.dbf
/data/u01/app/oracle/oradata/BHDB/pdbseed/system01.dbf
/data/u01/app/oracle/oradata/BHDB/bhdb_pdb/sysaux01.dbf
于是想在从库设置文件转换参数如下:(寻思想把涉及到的三个目录都转换成对应的dg库目录)
db_file_name_convert ='/data/u01/app/oracle/oradata/BHDB/pdbseed/', '/data/u01/app/oracle/oradata/BHDG/pdbseed/', '/data/u01/app/oracle/oradata/BHDB/bhdb_pdb/', '/data/u01/app/oracle/oradata/BHDB/bhdg_pdb/','/data/u01/app/oracle/oradata/BHDB/','/data/u01/app/oracle/oradata/BHDG/'
如上设置后,duplicate就一直报错,我检查了目录和权限都没有问题,可是就有问题,于是查看dg库的告警日志,如下所示:找不到目录!!!
Errors in file /data/u01/app/oracle/diag/rdbms/bhdg/bhdg/trace/bhdg_mz00_119260.trc:
ORA-01110: data file 14: '/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/kcas_bh02.dbf'
ORA-01565: error in identifying file '/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/kcas_bh02.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
奇怪了,我明明已经设置了要把'/data/u01/app/oracle/oradata/BHDB/bhdb_pdb/',转换成'/data/u01/app/oracle/oradata/BHDG/bhdg_pdb/',怎么不在'/data/u01/app/oracle/oradata/BHDG/bhdg_pdb/'创建文件?怎么报错了呢,怎么去'/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/'创建文件呢?于是我再dg库服务器创建上了'/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/'目录,然后再次执行,果然不报错了!
只能设置成,具体如下:
[oracle@ovy-01 admin]$ mkdir -p/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/
原来dg参数不能级联转换目录,只能转换上级目录,或者只能转换下级目录,也就是说你只能转换
'/data/u01/app/oracle/oradata/BHDB/' 到'/data/u01/app/oracle/oradata/BHDG/' ,然后子目录默认,也就是说/data/u01/app/oracle/oradata/BHDB/bhdb_pdb/到dg库转换成了/data/u01/app/oracle/oradata/BHDG/bhdb_pdb/, 或者你也可以转换/data/u01/app/oracle/oradata/BHDB/bhdb_pdb/ ------> /data/u01/app/oracle/oradata/BHDG/bhdg_pdb/ 但是前级目录是不能转换的,不管你是否设置了!
所以针对我的这种情况,只需要设置最前级目录,然后后面的都默认即可!因为别的子级别目录也不管用!具体如下:
SQL> alter system set db_file_name_convert ='/data/u01/app/oracle/oradata/BHDB/', '/data/u01/app/oracle/oradata/BHDG/' scope=spfile;
关于设置db_file_name_convert 参数的设置规则,否则都会报错
1.不能把主库的多个目录,转换到dg库的同一个目录
db_file_name_convert ='/data/u01/app/oracle/oradata/BHDB/', '/data/u01/app/oracle/oradata/BHDG/' ,'/data/u01/app/oracle/oradata/BHDB2/','/data/u01/app/oracle/oradata/BHDG/'
2.不能级联转换目录,如本文介绍的,也可能是我不知道怎么实现级联设置,如果有大神知道,可以指正!
3.目录一定要最后带上‘’/‘’,也就是必须要db_file_name_convert ='/data/u01/app/oracle/oradata/BHDB/', 而不能db_file_name_convert ='/data/u01/app/oracle/oradata/BHDB'.