码迷,mamicode.com
首页 > 数据库 > 详细

Oracle ADG数据库切换

时间:2019-01-22 10:42:59      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:primary   alt   ima   模式   to_char   状态   rtu   oracle   ini   

##############备库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数据库切换

标签:primary   alt   ima   模式   to_char   状态   rtu   oracle   ini   

原文地址:https://www.cnblogs.com/houzhiqing/p/10301974.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!