11.2.0.4 on Oracle Linux 5.8
1、检查primary的switchover_status
select switchover_status from v$database;
如果为sessions active或者to standby 都可以向下进行。
2、Prepare primary database
primary 上执行:
alter database prepare to switchover to logical standby;
执行完成后检查 switchover_status,如果是PREPARING SWITCHOVER则是成功
3、prepare logical standby
在logical standby上执行
alter database prepare to switchover to primary;
执行完成后如果查看switchover_status ,如果是preparing dictonary,表示LogMiner dictionary is being recorded inthe redo stream;
PREPARING SWITCHOVER表示此步骤已经完成
此时如果要撤销switchover,分别在primary和standby上先后执行
alter database prepare to switchovercancel;
4 、Switchover primary datanase to logical standby
alter database commit to switchover to logical standby;
这里不能有正在进行的transcation,查询v$transcation查询有哪些活动transcation
执行后primary也不能再执行任何transcation
5、switchover logical standby to primary
在这里logical standby一定要开启apply。当日志apply完成后,switchover_status会变成primary
在logica standby上查询switchover_status ,如果为TO PRIMARY则执行以下:
alter database commit to switchover to primary;
6、在新的standby上开启apply
alter database start logical standby apply immediate;