---
title: "在 OceanBase 数据库 V3.x 版本中进行主备切换时报错 ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed 的原因和解决方法-OceanBase数据库使用指南"
description: "了解OceanBase数据库在实际应用中关于 在 OceanBase 数据库 V3.x 版本中进行主备切换时报错 ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决 在 OceanBase 数据库 V3.x 版本中进行主备切换时报错 ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed 的原因和解决方法的难题。"
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# 在 OceanBase 数据库 V3.x 版本中进行主备切换时报错 ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed 的原因和解决方法

更新时间：2026-05-09 08:26

适用版本： V2.1.x、V2.2.x、V3.1.x、V3.2.x 内容类型：Troubleshoot  

## 问题现象

在 OceanBase 数据库 V3.x 版本中主备切换时，报错 `ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed`。

1. 主备切换。

   ```shell
   MySQL [oceanbase]> ALTER SYSTEM COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
   ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed

   ```
 2. 登录主集群，查询 `V$OB_STANDBY_STATUS` 视图，查看各个备集群的日志传输模式。

   ```shell
   MySQL [oceanbase]> SELECT * FROM V$OB_STANDBY_STATUS;

   ```

   输出结果如下：

   ```shell
   +------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+-----------+---------------+
   | cluster_id | cluster_name | cluster_role     | cluster_status | current_scn      | rootservice_list      | redo_transport_options       | protection_level    | synchronization_status |
   +------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+-----------+---------------+
   | 1721728395 | obtest       | PHYSICAL STANDBY | VALID          | 1722175185940113 | 172.xx.0.22:2882:2881 | ASYNC NET_TIMEOUT = 30000000 | MAXIMUM PERFORMANCE | NOT AVAILABLE          |
   | 1721728397 | obtest       | PHYSICAL STANDBY | VALID          | 1722179509315001 | 172.xx.0.23:2882:2881 | ASYNC NET_TIMEOUT = 30000000 | MAXIMUM PERFORMANCE | OK                     |
   +------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+----------+----------------+
   2 rows in set (0.00 sec)

   ```
 3. 查看关键日志信息。

   ```shell
   [2024-07-28 22:52:03.042220] WDIAG [SHARE] ob_multi_cluster_util.cpp:324 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=4] [dc=0][errcode=0] failed to get cluster info(ret=0, tmp_ret=-4711, cluster_addr={cluster_id:1721728395, cluster_type:2, cluster_status:1, timestamp:1722168739390107, cluster_name:"obtest", addr_list:[{server:"172.xx.0.22:2882", role:1, sql_port:2881, replica_type:0, reserved:0, property:{memstore_percent_:100}}], readonly_addr_list:[], cluster_idx:1, current_scn:-1, redo_transport_options:{net_timeout:30000000, reopen:300000000, max_failure:0, is_sync:false}, protection_level:0, sync_status:0, last_hb_ts:-1}, arg={need_check_sync:false, max_primary_schema_version:-1, primary_schema_versions:{tenant_schema_versions:[]}, cluster_version:18446744073709551615, standby_became_primary_scn:-1}, cluster_info={cluster_id:-1, cluster_type:0, login_name:"", switchover_status:"SWITCHOVER_INVALID", cluster_status:0, switch_timestamp:0, is_sync:false, gc_snapshot_ts:-1, protection_mode:0, version:-1, protection_level:0})
   [2024-07-28 22:52:03.042245] WDIAG [RS] ob_recovery_helper.cpp:1072 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=4] [dc=0][errcode=-4179] pre-check failed, refuse to switchover to standby(ret=-4179, cluster_info={cluster_id:1721728393, cluster_type:1, login_name:"__oceanbase_inner_standby_user", switchover_status:"SWITCHOVER_NORMAL", cluster_status:1, switch_timestamp:0, is_sync:false, gc_snapshot_ts:-1, protection_mode:0, version:1722164753108596, protection_level:0}, switchover_info={info:3440, info_str:"", synced_cluster_id_array:[], can_not_access_cluster:[]})
   [2024-07-28 22:52:03.042255] WDIAG ob_recovery_helper.cpp:1073 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=8] [dc=0][errcode=-4179] pre-check failed, switchover to standby not allowed

   ```

## 问题原因

主集群下存在两套备集群，其中一套备集群之前已被强制删除，该备集群不可访问且已不存在，报错 -4711 即为对应 Cluster 不可访问。

因主集群里仍存在已删备集群信息，导致主备切换 pre-check failed，主集群无法向另外一套运行正常的备集群进行切换。

## 问题的风险及影响

主备切换无法通过 pre-check。

## 影响租户

影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。

## 适用版本

OceanBase 数据库 V2.x、V3.x 版本。

## 解决方法及规避方式

- 解决方法：

  移除不可访问的备集群。

  ```shell
  ALTER SYSTEM REMOVE CLUSTER cluster_name cluster_id xxxxx;

  ```
 - 规避方式:

  删除备集群后，及时清理残留信息。建议通过 OCP 图形化界面，删除备集群，避免信息残留。

上一篇

[OceanBase 数据库主备集群切换，获取 switchover_scn 供 DSG、OMS 指向新主集群断点续传](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000001821748)

下一篇

[数据库备租户 Failover 后序列重复值问题分析与解决](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003732129) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
