DataGuard角色转换之physical standby switchover
在使用switchover进行角色转换时需先把pramary转换为standby再把standby转换为primary.若physical standby和logical standby同时存在,在选择standby首先phycial standby
1.确认是否可以进行角色转换
select switchover_status from v$database;
若查询结果为to_standby表明可以进行,若查询为session active,在执行switchover命令是就需要加上with session shudown
2.将primary database转换为standby database
alter database commit to switchover to physical standby;
或
alter database commit to switchover to physical standby with session shutdown;
3.关闭并重新启动新的standby
shutdown immediate;
startup mount;
alter database recover managed standby database disconnect;
现在同时存在两个standy
4.当把primary转换为standby时会在redo stream中产生一个标记,并将这个标记传给standby.这个标记说明不再产生redo了.当standby收到这个标记时,它就可以转换为primary了
查看swithover_status的状态
select switchover_status from v$database,关于switchover_status的说明同上
5.将standby转换为primary
alter database commit to switchover to primary;
或
alter database commit to switchover to primary with session shutdown;
6.关闭并重新启动新的primary
shutdown immediate;
startup;
7.确认
primary:
alter system switch logfile;
archive log list;
standby:
select process,status from v$managed_standby;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7419833/viewspace-604994/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7419833/viewspace-604994/