这篇文章主要介绍“怎么解决Oracle中dg主库创建文件备库未同步问题”,在日常操作中,相信很多人在怎么解决Oracle中dg主库创建文件备库未同步问题问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么解决Oracle中dg主库创建文件备库未同步问题”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
环境
备库standby_file_management参数为MANUAL
主库创建数据文件时备库应用失败
主库
SQL> create tablespace test datafile '+DATA/dgpri/datafile/test01.dbf' size 50m;
备库开启实时应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
查看日志
Archived Log entry 19 added for thread 1 sequence 30 rlc 1015097842 ID 0x3b7defac dest 2:
RFS[6]: No standby redo logfiles available for thread 1
RFS[6]: Opened log for thread 1 sequence 31 dbid 998109615 branch 1015097842
Thu Aug 01 01:20:03 2019
Media Recovery Log /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_30_1015097842.dbf
File #6 added to control file as 'UNNAMED00006' becausethe parameter STANDBY_FILE_MANAGEMENT is set to MANUALThe file should be manually created to continue.Errors with log /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_30_1015097842.dbf
MRP0: Background Media Recovery terminated with error 1274Errors in file /u01/app/oracle/diag/rdbms/dgphy/dgphy/trace/dgphy_pr00_74382.trc:
ORA-01274: cannot add datafile '+DATA/dgpri/datafile/test01.dbf' - file could not be created
....Managed Standby Recovery starting Real Time ApplyThu Aug 01 01:22:10 2019Errors in file /u01/app/oracle/diag/rdbms/dgphy/dgphy/trace/dgphy_dbw0_74012.trc:
ORA-01186: file 6 failed verification tests
ORA-01157: cannot identify/lock data file 6 - see DBWR trace fileORA-01111: name for data file 6 is unknown - rename to correct fileORA-01110: data file 6: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006'File 6 not verified due to error ORA-01157MRP0: Background Media Recovery terminated with error 1111Errors in file /u01/app/oracle/diag/rdbms/dgphy/dgphy/trace/dgphy_pr00_82248.trc:
ORA-01111: name for data file 6 is unknown - rename to correct fileORA-01110: data file 6: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006'ORA-01157: cannot identify/lock data file 6 - see DBWR trace fileORA-01111: name for data file 6 is unknown - rename to correct fileORA-01110: data file 6: '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006'Managed Standby Recovery not using Real Time Apply
此时备库执行
SQL> alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006' as '+DATA/dgphy/datafile/test01.dbf';
Database altered.
再开启实时应用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.
查看日志
ALTER SYSTEM SET standby_file_management='MANUAL' SCOPE=BOTH;alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006' as '+DATA/dgphy/datafile/test01.dbf'Completed: alter database create datafile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00006' as '+DATA/dgphy/datafile/test01.dbf'Thu Aug 01 01:23:04 2019ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSIONAttempt to start background Managed Standby Recovery process (dgphy)
Thu Aug 01 01:23:04 2019MRP0 started with pid=24, OS id=82426
MRP0: Background Managed Standby Recovery process started (dgphy)
started logmerger process
Thu Aug 01 01:23:10 2019Managed Standby Recovery starting Real Time ApplyParallel Media Recovery started with 2 slaves
Waiting for all non-current ORLs to be archived...All non-current ORLs have been archived.
Thu Aug 01 01:23:10 2019Archiver process freed from errors. No longer stopped
Media Recovery Log /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_30_1015097842.dbf
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSIONMedia Recovery Log /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch2_31_1015097842.dbf
Media Recovery Waiting for thread 1 sequence 32 (in transit)
此时实时应用已经成功完成
查看进程
SQL> ! ps -ef|grep mrp
oracle 74365 1 0 00:43 ? 00:00:00 ora_mrp0_dgphy
oracle 81797 80300 0 01:19 pts/14 00:00:00 /bin/bash -c ps -ef|grep mrp
oracle 81799 81797 0 01:19 pts/14 00:00:00 grep mrp
查看数据文件
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/dgphy/datafile/system.277.1015099429
+DATA/dgphy/datafile/sysaux.278.1015099475
+DATA/dgphy/datafile/undotbs1.280.1015099527
+DATA/dgphy/datafile/users.281.1015099533
+DATA/dgphy/datafile/example.279.1015099511
+DATA/dgphy/datafile/test01.dbf
6 rows selected.
发现问题已经解决了,最后
alter system set standby_file_management='AUTO';
到此,关于“怎么解决Oracle中dg主库创建文件备库未同步问题”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!