1. 检查主库状态:
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
TO STANDBY
2. 检查备库状态(MRP0进程是否存在):
select count(*) num from v$process where pname='MRP0';
select process, status, sequence# from v$managed_standby
3. 关闭主备库非控节点
4. 主控节点断监听
srvctl stop listener -n $HOST_NAME
ps -ef|grep LOCAL=NO|grep -v grep|awk {'print $2'}|xargs kill -9
5. 主库切归档
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
6. 主库执行切换动作
alter database commit to switchover to physical standby with session shutdown;
7. 备库停监听 断连接
srvctl stop listener -n $HOST_NAME
ps -ef|grep LOCAL=NO|grep -v grep|awk {'print $2'}|xargs kill -9
8. 备库取消日志应用