Oracle ADG数据库切换

Posted 侯志清-江西南昌

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle ADG数据库切换相关的知识,希望对你有一定的参考价值。

##############备库failover 到主库############################################################
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
ALTER DATABASE OPEN;

##########################快速恢复新备段###################################################
新主端
select to_char(standby_became_primary_scn) from v$database;
新备端
startup mount;
flashback database to scn standby_became_primary_scn;
alter database convert to physical standby;
shutdown immediate;
startup mount;
alter database recover managed standby database using current logfile disconnect;
recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect from session;
###############################################################################################

 


############################switch over切换#######################################
正常切换-主库
alter database commit to switchover to physical standby with session shutdown;
确认主库变成备库后是否是在mount状态
select open_mode from v$databasel
################################################################################


################################################################################
检查备库状态-备库,需要等待备库变成to primary状态
select open_mode,protection_mode,protection_level,switchover_status from v$database;

select open_mode,protection_mode,protection_level,switchover_status from v$database; 
OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL SWITCHOVER_STATUS 
-------------------- -------------------- -------------------- -------------------- 
READ ONLY WITH APPLY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE NOT ALLOWED 
SQL> / OPEN_MODE PROTECTION_MODE PROTECTION_LEVEL SWITCHOVER_STATUS 
-------------------- -------------------- -------------------- -------------------- 
READ ONLY WITH APPLY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE TO PRIMARY


alter database commit to switchover to primary;
alter database open;
######################################################################################


###########################新备库打开到只读模式,实时应用日志#########################
alter database open read only;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

 

以上是关于Oracle ADG数据库切换的主要内容,如果未能解决你的问题,请参考以下文章

oracle11g ADG主备切换

12c Oracle ADG日志切换hang

Oracle公有云上的ADG配置(单实例)

Oracle 11g R2 ADG 搭建

Oracle 11g R2 ADG 运维

Oracle 11g Dataguard 配置,维护与详解 (ADG)