近期有个友商在做RMAN duplidate database搭建DG时,因为primary db上有offline 的datafile ,并且归档已经丢失,无法再做recover ,online datafile的操作,操作系统或存储上的datafile已经不存在,duplicate时报错如下。
Starting backup at 19-NOV-20
RMAN-06169: could not read file header for datafile 357 error reason 4
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
released channel: stby
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/19/2020 17:15:03
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06056: could not access datafile 357
发现主库上有offline状态的datafile: file#=357 name=+DATA/tyjc/datafile/service_main_dat.256.862604801
[oracle@oel7db1 ~]$ oerr rman 6169
6169, 3, "could not read file header for datafile %(1)s error reason %(2)s"
// *Cause: The specified data file could not be accessed. The reason
// codes are:
// 1 - file name is MISSINGxx in the control file
// 2 - file is offline
// 3 - file is not verified
// 4 - DBWR could not find the file
// 5 - unable to open file
// 6 - I/O error during read
// 7 - file header is corrupt
// 8 - file is not a data file
// 9 - file does not belong to this database
// 10 - file number is incorrect
// 12 - wrong file version
// 15 - control file is not current
// *Action: If the error can be corrected, do so and retry the operation.
// The SKIP option can be used to ignore this error during a backup.
Oracle官方支持的方法1是rman 备份指定skip,Try this command to SKIP the offline and corrupted datafiles:
BACKUP DATABASE
SKIP INACCESSIBLE
SKIP OFFLINE;
SKIP INACCESSIBLE: Inaccessible datafiles. A datafile is only considered inaccessible if it cannot be read. Some offline datafiles can still be read because they exist on disk. Others have been deleted or moved and so cannot be read, making them inaccessible.
SKIP OFFLINE: skipping Offline datafiles;
rman生成备份集的方法可行,但是duplicate database中没有skip INACCESSIBLE, 只有skip readonly 和skip tablespace:
DUPLICATE Options
Explanation
SKIP READONLY
Excludes the data files of read-only tablespaces from the duplicate database.
SKIP TABLESPACE 'tablespace_name ', ...
Excludes the specified tablespaces from the duplicate database. You cannot exclude the SYSTEM and SYSAUX tablespaces, tablespaces with SYS objects, undo tablespaces, tablespaces with undo segments, tablespaces with materialized views, or tablespaces in such a way that the duplicated tablespaces are not self-contained.
支持的方法2, 把该表空间(包含offline datafile)的对象move到其它表空间, drop tablespace xxx including datafile and contents,或duplicate skip tablespace。
或者
alter database create datafile ”; — 创建出OS或存储已不存在的物理数据文件,但还是offline的。
官方不支持的方法:
1,alter database create datafile ”;
2,bbed 修改checkpoint scn信息;
3,recover datafile;
4,online datafile;
5, drop datafile;
打赏
微信扫一扫,打赏作者吧~