主备数据库版本:oracle 11.2.0.4 64位
问题描述:主备库都开启的状态单独重启备库出现以下异常
SQL> startup
ORACLE instance started.
Total System Global Area 3206836224 bytes
Fixed Size 2257520 bytes
Variable Size 1811942800 bytes
Database Buffers 1375731712 bytes
Redo Buffers 16904192 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:'/u01/app/oracle/oradata/orcl151/system01.dbf'
查询资料,确认到异常原因为日志的scn与控制文件不一致,以下为处理步骤:
备库启动到mount状态:
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 3206836224 bytes
Fixed Size
2257520 bytesVariable Size 1811942800
bytesDatabase Buffers
1375731712 bytesRedo Buffers
16904192 bytesDatabase mounted.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
主库操作:
SQL> alter system switch logfile;
System altered.
SQL> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by
1,2;
THREAD# SEQUENCE# TO_CHAR(FIRST_TIME,'YYYY-MM-DDHH24:MI: APPLIED
---------- ---------- -------------------------------------- ------------------
1 138 2022-01-22 22:43:24 YES
1 139 2022-01-22 22:43:51 NO
1 139 2022-01-22 22:43:51 YES
1 140 2022-01-22 22:46:05 NO
1 140 2022-01-22 22:46:05 YES
1 141 2022-01-22 22:46:41 NO
1 141 2022-01-22 22:46:41 YES
1 142 2022-01-22 22:50:06 NO
1 142 2022-01-22 22:50:06 NO
42 rows selected.
注意:当全部归档日志归档完成,在到备库操作,同一时间点APPLIED值一个为NO,一个为YES,才算正常。
此时备库操作:
确认主备库监听正常开启,然后tnsping测试互通性,发现备库tnsping不通主库,而主库能tnsping通备库.
查看主库防火墙为开启状态,将其关闭后主备库通信无问题.
备库执行:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
说明:成功开启备库.