已索引

检查日志同步

如果日志同步异常,不要做切换。

在主库上查询:

SQL> SELECT INST_ID, DEST_ID, STATUS, GAP_STATUS FROM GV$ARCHIVE_DEST_STATUS WHERE DEST_ID = 2;
 

   INST_ID    DEST_ID STATUS    GAP_STATUS
---------- ---------- --------- ------------------------
         2          2 VALID     NO GAP
         1          2 VALID     NO GAP

在备库上查询:

SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM GV$ARCHIVE_GAP;

no rows selected

检查数据文件和临时文件

在主备库上做如下的查询检查所有 datafile 状态 online,主备库 tempfile 匹配。
注:对 datafile 做 offline 的测试,命令正常返回不报错,但是查询状态仍然是 AVAILABLE。

SQL> select name from v$datafile where status='OFFLINE';

no rows selected
set lines 200;
col filename for a60;
select tmp.name FILENAME, bytes/1024/1024/1024 as SIZE_GB, ts.name TABLESPACE
from v$tempfile tmp, v$tablespace ts where tmp.ts#=ts.ts#;

FILENAME                                                        SIZE_GB TABLESPACE
------------------------------------------------------------ ---------- ------------------------------
+DATA/DEMODBSTD/TEMPFILE/temp.313.1179505317                 .073242188 TEMP

官方建议的

如下两条官方文档上有写,但是不做也可以(目前还没有这样做过)。

Before performing a switchover from an Oracle RAC primary database to a physical standby database, shut down all but one primary database instance. Any primary database instances shut down at this time can be started after the switchover completes.
主库仅保留一个实例,关闭所有其它实例。关闭的实例在切换会自动拉起来。

Before performing a switchover to a physical standby database that is in real-time query mode, consider bringing all instances of that standby database to the mounted but not open state to achieve the fastest possible role transition and to cleanly terminate any user sessions connected to the physical standby database prior to the role transition.
如果备库处于 real-time query 模式,可以考虑把所有备库实例置于 mounted 模式,这样可以断开所有用户会话,实现最快的切换。

Failover 的额外要求

除以上条件外,对于 Failover,不能 Fail over 到运行在 maximum protection 模式的备库。

需要在备库上执行如下命令将其修改为 maximum performance 模式:
SQL> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;

In addition, if a primary database in maximum protection mode is still actively communicating with the standby database, issuing the ALTER DATABASE statement to change the standby database from maximum protection mode to maximum performance mode will not succeed. Because a failover removes the original primary database from the Data Guard configuration, these features serve to protect a primary database operating in maximum protection mode from the effects of an unintended failover.

-- By 许望(RHCA、OCM、VCP)
最后修改:2024 年 09 月 23 日 05 : 11 PM
如果觉得我的文章对你有用,请随意赞赏