前一天在客户现场部署完DG,同步正常,第二天早上再次查看同步的时候,发现备库的节点一是关闭状态,节点二是mount状态,启动节点一的时候报如下错误:
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 8 01:48:31 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 7482626048 bytes
Fixed Size 2267792 bytes
Variable Size 2768242032 bytes
Database Buffers 4697620480 bytes
Redo Buffers 14495744 bytes
Database mounted.
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '+DBNMS_DATA01/dbnmsdg/datafile/system.361.983530577'
尝试自动同步日志也失败
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '+DBNMS_DATA01/dbnmsdg/datafile/system.361.983530577'
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
--------------------
NOT ALLOWED
后来在排查的时候,发现是监听停了,应该是系统重启或异常导致的,重启监听,开启MRP进程,尝试让其自动同步
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL>
SQL> SELECT al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
FROM (select thread# thrd, MAX(sequence#) almax
FROM v$archived_log
WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) al,
(SELECT thread# thrd, MAX(sequence#) lhmax
FROM v$log_history
WHERE resetlogs_change#=(SELECT resetlogs_change# FROM v$database) GROUP BY thread#) lh
WHERE al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 15633 15600
2 33892 33822
SQL> /
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 15633 15600
2 33892 33822
在主库查看seq号等他全部同步完全
SQL>
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 15633
Next log sequence to archive 15634
Current log sequence 15634
SQL>
查看同步完成,取消同步,然后恢复,再次打开数据库,正常打开。
SQL> /
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 15633 15633
2 33892 33892
SQL> recover managed standby database cancel;
Media recovery complete.
SQL>
此时可以正常打开数据库了
SQL> alter database open ;
Database altered.
SQL>
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL>
查询同步状态,处于applying_log状态
SQL> select PROCESS,PID,STATUS, GROUP# , RESETLOG_ID,THREAD#,SEQUENCE# from v$managed_standby where process='MRP0';
PROCESS PID STATUS GROUP# RESETLOG_ID THREAD# SEQUENCE#
--------- ---------- ------------ ---------------------------------------- ----------- ---------- ----------
MRP0 2336 APPLYING_LOG N/A 964606422 2 33894