Switchover 主从切换正确步骤
一:将主库切换成备库
1:检查主库当前状态:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
----------------------------------------
TO STANDBY
2:将主库切换为standby:
SQL> alter database commit to switchover to physical standby;
Database altered.
3:重启原主库到mount下:
SQL> shutdown immediate
SQL> startup mount
二:将备库切换成主库
1:检查备库当前状态:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
2:将备库切换成主库:
SQL> alter database commit to switchover to primary;
Database altered.
3:将新主库打开到OPEN状态:
SQL> alter database open;
Database altered.
三:启动实时日志应用:
因原主库切成了standby,但是还没执行日志应用,执行下面命令:
SQL> alter database recover managed standby database disconnect from session;
Database altered.
OK,执行完上面操作后,数据就可以自动同步了。
阅读(1701) | 评论(0) | 转发(0) |