物理备库ORA 01274问题处理

来源:互联网 发布:北京工业大学未来网络 编辑:程序博客网 时间:2024/06/09 06:24

我的物理备库因ora 01274问题导致MRP终止并启动失败。这个问题处理起来很简单,但是百度搜了篇文章差点把我带坑里,因此我把MOS的标准步骤写下来,给各位朋友一个参考。

这个DG环境在两周前已经搭建好,今天需要正式切换。切换前,惯例先检查下主备库状态。这一查发现备库已经有一周多没有应用日志了。由于DG搭建是有一个checklist的,因此不会是忘记开启MRP,肯定是中间有问题导致日志应用断了。查看备库alert,发现如下报错:

Fri Nov 24 16:39:15 2017File #9 added to control file as 'UNNAMED00009' becausethe parameter STANDBY_FILE_MANAGEMENT is set to MANUALThe file should be manually created to continue.MRP0: Background Media Recovery terminated with error 1274Errors in file /u01/app/oracle/diag/rdbms/dbnamestby/dbname/trace/dbname_pr00_46964.trc:ORA-01274: cannot add datafile '+DATA/dbnameprmy/datafile/datafile.491.960914347' - file could not be createdManaged Standby Recovery not using Real Time ApplyRecovery interrupted!Recovery stopped due to failure in applying recovery marker (opcode 17.30).Datafiles are recovered to a consistent state at change 12687535588875 but controlfile could be ahead of datafiles.Fri Nov 24 16:39:17 2017MRP0: Background Media Recovery process shutdown (dbname)

查看该错误代码:

01274, 0000, "cannot add datafile '%s' - file could not be created"// *Cause: Automated standby file management was disabled, so an added file//         could not automatically be created on the standby.//         The error from the creation attempt is displayed in another message.//         The control file file entry for the file is 'UNNAMEDnnnnn'.// *Action: Use the ALTER DATABASE CREATE DATAFILE statement to create the//          file, or set STANDBY_FILE_MANAGEMENT to AUTO and restart//          standby recovery.

解决步骤也很简单:(注:针对12c以下版本。我的是11.2 版本。对于PDB,MOS上另有步骤)

1、备库的 standby_file_management 要设置成 MANUAL 状态.

2、找到这个在备库不能创建的文件名字

SQL> select name from v$datafile;NAME -------------------------------------------------------------------------------- D:\ORADATA\MYSTD\SYSTEM.DBF D:\ORADATA\MYSTD\UNDO.DBF D:\ORADATA\MYSTD\SYSAUX.DBF D:\ORADATA\MYSTD\SERVICE01.DBF C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005 

3、重建该数据文件

SQL> alter database create datafile 'C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005' as 'D:\oradata\mystd\sales01.dbf';
如果备库使用了ASM+OMF,则也可使用如下命令:
SQL> alter database create datafile '/oracle/product/GSIPRDGB/dbs/UNNAMED00210' as <'+ASMDISKGROUPNAME'> size <specify the size of datafile>;orSQL>alter database create datafile '/oracle/product/GSIPRDGB/dbs/UNNAMED00210' as new;

4、查看新的数据文件名,应该已经一致了

SQL> select name from v$datafile;NAME -------------------------------------------------------------------------------- D:\ORADATA\MYSTD\SYSTEM.DBF D:\ORADATA\MYSTD\UNDO.DBF D:\ORADATA\MYSTD\SYSAUX.DBF D:\ORADATA\MYSTD\SERVICE01.DBF D:\ORADATA\MYSTD\SALES01.DBF 

5、将STANDBY_FILE_MANAGEMENT 参数修改为AUTO,以防以后还有此类情况发生;


6、开启MRP。


日志里可以看到redo在应用。