目录
Oracle-DG/ADG灾备之三—灾备恢复演练之3—灾难性恢复(failover)备库切换为新主库,原主库修复启动后,恢复为新备库
一、原主库修复启动后,要恢复为新备库
1、前提条件
这里介绍Failover后利用闪回恢复主从同步的方法,要求原主库(Failover后的备库)闪回功能必须打开并且闪回日志还在。
利用DG Broker操作的方法放在下一篇介绍,其实原理是一样的,只是Oracle帮你做了。
2、假设当前failover已完成,新主库已打开。
(1)在新主库上执行:
select to_char(standby_became_primary_scn) from v$database;
(2)在原主库上,也就是现在的备库执行:
startup mount flashback database to scn 956856; --这个值为在新主库上查询到的SCN值 alter database convert to physical standby; shutdown immediate startup alter database recover managed standby database using current logfile disconnect from session parallel 4;
至此,failover和其后的主从同步恢复已经完成,下一篇来看如何利用DG Broker来简化这些操作。
(3)查看归档
主库归档查看:select unique thread#,max(sequence#) over(partition by thread#)last from v$archived_log; 备库归档查看:select unique thread#,max(sequence#) over(partition by thread#)last from v$archived_log;
(4)如果主备归档不一致
在主库执行:
execute sys.dbms_backup_restore.resetCfileSection(11);
(5)查看归档
主库归档查看:select unique thread#,max(sequence#) over(partition by thread#)last from v$archived_log; 备库归档查看:select unique thread#,max(sequence#) over(partition by thread#)last from v$archived_log;