本文主要是介绍oracle物理DG管理-手工主备切换,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
主备切换,包括2种switchover与 failover
具体环境http://blog.csdn.net/sunziyue/article/details/50799648基础之上操作
1switchover操作
1.1在DG主库上(orcl)执行:
select switchover_status from v$database;
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
alter database commit to switchover to physical standby;
或者
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
alter database commit to switchover to physical standby with session shutdown;
然后重启至mount
startup nomount
alter database mount standby database;
1.2在DG备库(orcldg)上执行:
select sequence#, applied from v$archived_log where applied='YES'order by sequence#;//查日志应用
select switchover_status from v$database;//确认状态
alter database commit to switchover to primary;
shutdown immediate
startup
物理DG切换完成。
2failover切换物理DG
2.1检查归档文件是否连续SQL>SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP; //如果有记录,复制对应的归档到待转换的standby 服务器。
//注册
SQL>ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filename';
//关闭apply和结束应用动作
SQL>alter database recover managed standby database finish force;//force关键字将会停止当前活动的RFS 进程,以便立刻执行failover。
//切换
SQL>alter database commit to switchover to primary;
或者
SQL>alter database commit to switchover to primary with session shutdown;
//直接打开
SQL>alter database open;
完成。
这篇关于oracle物理DG管理-手工主备切换的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!