首批通过分布式安全可靠测评,为关键业务系统打造
OceanBase 数据库主备集群切换,获取 switchover_scn 供 DSG、OMS 指向新主集群断点续传
更新时间:2026-05-09 08:26
OceanBase 数据库增量同步工具如 DSG、OMS 尚不支持指向备集群进行 CDC 抽取,因此 OceanBase 数据库集群主备切换时,需适配变更指向新主集群 switchover SCN 位点续传。
详细说明
以下为 OceanBase 数据库主备集群切换时,获取准确 siwtchover_scn 位点指令及查询示例。
切换后在新主集群 SYS 租户下,执行如下语句。
[oceanbase]> select gmt_create,module,event,name1,usec_to_time(value4) as switchover_timestamp,value4 as switchover_scn from __all_rootservice_event_history where module='switch_cluster' and name4='switchover_timestamp';
+----------------------------+----------------+----------------------------+-------+----------------------------+------------------+
| gmt_create | module | event | name1 | switchover_timestamp | switchover_scn |
+----------------------------+----------------+----------------------------+-------+----------------------------+------------------+
| 2024-11-23 01:00:46.597627 | switch_cluster | precheck_sys_tenant_schema | ret | 2024-11-23 01:00:39.514112 | 1732294839514112 |
| 2024-11-23 01:00:46.616999 | switch_cluster | precheck_log_latest | ret | 2024-11-23 01:00:39.514112 | 1732294839514112 |
+----------------------------+----------------+----------------------------+-------+----------------------------+------------------+
2 rows in set (0.009 sec)
[oceanbase]> select * from v$ob_cluster_event_history where facility='switchover to primary' order by timestamp desc limit 3;
+-----------------------+----------+------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| facility | severity | error_code | timestamp | message |
+-----------------------+----------+------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| switchover to primary | CONTROL | 0 | 2024-11-23 01:00:46.683730 | flag:"finish", switchover_timestamp:1732294839514112, cost:108977, ddl_stmt_str:"ALTER SYSTEM COMMIT TO SWITCHOVER TO PRIMARY", trace_id:xxxxxxxxxxxx-xxxxxxxxxxxxxxxx-x-x |
| switchover to primary | CONTROL | 0 | 2024-11-23 01:00:46.574752 | flag:"start", ddl_stmt_str:"ALTER SYSTEM COMMIT TO SWITCHOVER TO PRIMARY", trace_id:xxxxxxxxxxxx-xxxxxxxxxxxxxxxx-x-x |
+-----------------------+----------+------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.011 sec)
影响租户
影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。
适用版本
OceanBase 数据库 V3.x 版本。