手记

ORACLE 11G DATA GUARD主从切换


当oracle data guard中如主库出现当机时,需要将从库切换为主库,以下从实验环境模拟主从库切换操作:

1.查看主从库角色

192.168.88.120:

p_w_picpath

192.168.88.119:

p_w_picpath

2.将主库(88.120)切换为从库

alter database commit to switchover to physical standby with sessionB shutdown;

p_w_picpath

shutdown immediate; 

startup nomount; 

alter database mount standby database;

recover managed standby database disconnect;

p_w_picpath 

3.主库切换完成,开启数据库

alter database open或shutdown以后startup

p_w_picpath

4..将从库切换为主库

alter database commit to switchover to primary;

shutdown immediate

startup

p_w_picpath

5.在从库上应用重做日志

alter database recover managed standby database disconnect from session;

6..查看切换后状态

192.168.88.119:

p_w_picpath 

192.168.88.120:

p_w_picpath

7..验证切换是否成功(角色切换过来后需要查看日志是否能正确从新的主库同步到备用库)

在主从库上分别执行

SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

新主库88.119:

p_w_picpath

新从库88.120:

p_w_picpath

通过主从库新的归档应用和确认状态可查看到两个库的角色已经成功切换!

©著作权归作者所有:来自51CTO博客作者ttzztt的原创作品,如需转载,请注明出处,否则将追究法律责任

ORACLEDATA11GORACLE


0人推荐
随时随地看视频
慕课网APP