---
title: 如何处理全量迁移中索引迁移无进展的问题-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于如何处理全量迁移中索引迁移无进展的问题相关的常见问题和使用技巧，帮助您快速解决如何处理全量迁移中索引迁移无进展的问题的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")

## 体验新一代 AI 数据平台

[立即咨询](https://www.oceanbase.com/contactus) [免费试用 免费试用](https://www.oceanbase.com/free-trial)划线反馈

# 如何处理全量迁移中索引迁移无进展的问题

更新时间：2026-06-22 02:01

内容类型：How-to  

本文为您介绍使用 OceanBase 迁移服务（OceanBase Migration Service，OMS）进行全量迁移时，索引迁移一直没有进展的原因和解决方法。

## 适用版本

适用于 OceanBase 数据库 V3.x 和 V4.x。

## 问题描述

- 问题一：迁移 MySQL 数据库的数据至 OceanBase 数据库 MySQL 兼容模式时，全量迁移步骤的索引迁移一直没有进展。暂停数据迁移任务并重新启动后，没有产生新日志。暂停 OMS 容器并重启后，也没有产生新日志及进展。

  ![image001](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration001.png)

  查看组件监控无异常：

  ![image002](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration002.png)

  查看各组件状态显示正常：

  ![image003](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration003.png)
 - 问题二：部分数据迁移任务报错如下。

  ```shell
  com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 368127, active 60, maxActive 60

  ```

  ![image004](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration004.png)

## 关键信息

1. 查看 OMS 日志。

   ```shell
   docker exec -it oms bash
   cd /home/admin/logs/ghana/Ghana
   tail -f *.log|grep -E '==|DDLs concurrent number is too much|skip this scheduler'

   ```

   发现有 `DDLs concurrent number is too much` 提示并发过大的信息。

   ```shell
   ==> oms-scheduler.log <==
   ...
   2024-11-25 09:54:11.348 [INFO] [getAndExecuteDDLForObjectsExecutor-18] [a9bd61db-44e3-4f53-82ae-6f1cxxxx] DDLs concurrent number is too much, just skip this scheduler. project id np_69gjfsq2e61s, task id 1859873303511334914

   ```
 2. 登录容器，进入 OMS Meta 租户查询。

   ```shell
   docker exec -it oms bash
   mysql -h10.10.10.1 -P2883 -uxxxx@oms_xxxx#mexxxx -pxxxx -A -Doms_rm

   ```

   在页面查看 `project_id` 或根据如下 SQL 查询 `project_id`。

   ```shell
   MySQL [oms_rm]> select id,name,type,status,gmt_create,gmt_finish from project where status NOT IN ('FINISHED','RELEASED') order by gmt_create;
   +-----------------+-------------+-----------+----------+---------------------+---------------------+
   | id              | name        | type      | status   | gmt_start           | gmt_finish          |
   +-----------------+-------------+-----------+----------+---------------------+---------------------+
   | np_69gg53h59veo | perf_1      | MIGRATION | RUNNING  | 2024-11-26 14:03:33 | NULL                |
   ...

   ```
 3. 根据 `project_id` 查询 `oms_step`，可以在 `extra_info` 看出报错信息或在 `step_info` 中找到 `jobId`。

   ```shell
   MySQL [oms_rm]> select * from oms_step where project_id = 'np_69ggxxxx' and is_show = 1 and step_status = 'RUNNING'\G
   *************************** 1. row ***************************
               id: s_69gg54arkj0i
       project_id: np_69gxxxx
       step_order: 4
        step_name: INDEX_TRANSFER
        step_desc: 索引迁移
      step_status: RUNNING
        step_info: {"jobId":"1859864001039990785"}
          is_show: 1
       extra_info: {"failedTime":"2024-11-23T02:31:23.867"}
       start_time: 2024-11-22 15:45:55
      finish_time: 2024-11-25 12:00:33
       gmt_create: 2024-11-22 15:38:20
     gmt_modified: 2024-11-25 12:01:16
    step_progress: 64
   remaining_seconds: -1
      retry_count: 0
      interactive: 0
   1 row in set (0.001 sec)

   ```

   ```shell
   MySQL [oms_rm]> select * from oms_step where project_id = 'np_69gjls8xzznl' and is_show = 1 and step_status NOT IN ('FINISHED','INIT')\G
   *************************** 1. row ***************************
               id: s_69gjlxxxx
       project_id: np_69gjlsxxxx
       step_order: 4
        step_name: INDEX_TRANSFER
        step_desc: 索引迁移
      step_status: SUSPEND
        step_info: {"jobId":"18598737695xxxx"}
          is_show: 1
       extra_info: {"errorCode":"INNER_ERROR","errorMsg":"nested exception is org.apache.ibatis.exceptions.PersistenceException: \n### Error updating database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 431990, active 60, maxActive 60, creating 0\n### The error may exist in com/alipay/oms/common/dal/mapper/migrate/OmsStructMigrationRecordMapper.java (best guess)\n### The error may involve com.alipay.oms.common.dal.mapper.migrate.OmsStructMigrationRecordMapper.updateById\n### The error occurred while executing an update\n### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 431990, active 60, maxActive 60, creating 0","failedTime":"2024-11-23T02:53:30.205"}
       start_time: 2024-11-22 17:14:54
      finish_time: 2024-11-25 10:13:03
       gmt_create: 2024-11-22 16:17:09
     gmt_modified: 2024-11-25 10:13:02
    step_progress: 73
   remaining_seconds: -1
      retry_count: 0
      interactive: 0
   1 row in set (0.001 sec)

   ```

   从 extra_info 可以看到 OMS 连接 MetaDB 失败，从连接池获取链接超时。

   ```shell
   org.springframework.jdbc.CannotGetJdbcConnectionException;Failed to obtain JDBC Connection;
   nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException;wait millis 431990, active 60, maxActive 60, creating 0

   ```

## 问题原因

- 同时运行 3 个以上的数据迁移任务（每个任务迁移 10 万张表），创建索引的并发请求数据过高。
 - OMS 连接 MetaDB 的连接池满。

## 影响租户

影响 OceanBase 数据库中的 Oracle 兼容模式租户和 MySQL 兼容模式租户，对于 SYS 租户无影响。

## 解决方法

存在多个数据迁移任务并且迁移对象较多（例如本文示例中迁移任务大于 4 个，每个任务迁移 10 万张表）时，可能导致索引迁移无进展或 OMS 连接 MetaDB 的连接池满，相应的解决方法如下。

### 索引迁移无进展

对于创建索引并发请求数量过大，导致索引迁移无进展的情况，您可以尝试在 **系统参数** 页面搜索 `struct.transfer.config`，并调小 `project.index.execute.batch.size` 或调大 `project.index.execute.max.parallel`。

![image005](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration005.png)

然后根据 `oms_step. step_info` 中的 `jobId` 查询 `oms_struct_migration_record`，结果如下。

```shell
MySQL [oms_rm]> select obj_type,post_script_executed,record_status,count(1) from oms_struct_migration_record where task_id = '18598640010xxxx' group by obj_type,record_status,post_script_executed ORDER BY obj_type,record_status,post_script_executed;
+----------+----------------------+----------------------+----------+
| obj_type | post_script_executed | record_status        | count(1) |
+----------+----------------------+----------------------+----------+
| index    |                    0 | APPLYING             |       71 |
| index    |                    0 | FINISHED             |     2541 |
| index    |                    0 | READY                |    26493 |
| schema   |                    0 | FINISHED             |       21 |
| table    |                    1 | FINISHED             |     9543 |
| table    |                    1 | FINISHED_HAS_CONVERT |        9 |
+----------+----------------------+----------------------+----------+
6 rows in set (0.321 sec)

```

可以看到 `obj_type` 为 `index` 且 `record_status` 为 `APPLYING` 的较多，将 `record_status` 为 `APPLYING` 的改为 `READY`（自动进入队列重新调度）或 `APPLY_FAILED`（最后需要手动点恢复重新执行），建议加 limit 以避免多更新数据。

```shell
update oms_struct_migration_record
set record_status='READY' where task_id = '185986400103xxxx' and obj_type = 'index' and record_status in ('APPLYING') limit 71;

```

OMS 将按照新的设置重新调度 DDL 任务。修改后持续查询并观察进展变化。

### OMS 连接 MetaDB 的连接池满

对于 OMS 连接 MetaDB 的连接池满的情况，您可以在 OMS Docker 中修改如下参数。

```shell
docker exec -it oms bash
[root@ocp ~]# grep maxTotal /home/ds/ghana/config/application-oms.properties
maxTotal=120

```

然后重启 `oms_console`（请勿重启 OMS 容器以避免参数修改丢失）。

```shell
supervisorctl restart oms_console

```

## 规避方式

您可以通过以下三种方式对该类问题的出现进行规避。

- 减少数据迁移任务的数量。
 - 减少数据迁移任务中迁移对象的数量。
 - 在 OMS 迁移非大表时，选择不允许索引后置，先创建索引再迁移数据。

  ![image006](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/oms/oms-enterprise/20250110migration006.png)

Previous

[OMS 迁移无主键分区表性能较差](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003169932)

Next

[如何跳过 DDL](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000234454) ![有帮助](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) 咨询
