---
title: 因租户 id 大于 10W，OceanBase 数据库 V4.x 创建租户一直是 creating 状态的原因及解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于因租户 id 大于 10W，OceanBase 数据库 V4.x 创建租户一直是 creating 状态的原因及解决方法相关的常见问题和使用技巧，帮助您快速解决因租户 id 大于 10W，OceanBase 数据库 V4.x 创建租户一直是 creating 状态的原因及解决方法的难题。
---
切换语言

- 简体中文
- English

划线反馈

# 因租户 id 大于 10W，OceanBase 数据库 V4.x 创建租户一直是 creating 状态的原因及解决方法

更新时间：2026-06-10 01:56

适用版本： V4.0.x、V4.1.x、V4.2.x 内容类型：Troubleshoot  

## 问题现象

创建租户，`__all_tenant` 里一直是 creating 状态。

## 问题原因

tenant_id 过大导致，是 OceanBase 数据库 V4.x 版本的一个 bug， 创建租户资源池不存在的话，再成功创建租户的 tenant_id 会被推高。

![image](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/storage/20250324ob4x-tenant-creation-status-is-always-in-creating-state.png)

关键日志信息。

```shell
[2024-11-26 10:12:02.789698] WDIAG [COMMON] put (ob_kv_storecache.cpp:352) [91748][T2529341_DiskCB][T2529341][xxxx-xxxxx-xxxxx-xxxxx] [lt=16][errcode=-4002] The tenant_id is too large, (inst_key={cache_id:9, tenant_id:2529341}, ret=-4002)
[2024-11-26 10:12:02.789717] WDIAG [COMMON] put_and_fetch (ob_kv_storecache.h:586) [91748][T2529341_DiskCB][T2529341][xxxxx-xxxxx-xxxxx-xxxxx] [lt=18][errcode=-4002] Fail to put kv to ObKVGlobalCache, (cache_id=9, ret=-4002)
[2024-11-26 10:12:02.789723] WDIAG [STORAGE] process_aux_tablet_info (ob_storage_meta_cache.cpp:422) [91748][T2529341_DiskCB][T2529341][xxxxx-xxxxx-xxxxx-xxxxx] [lt=5][errcode=-4002] fail to put and fetch value into storage meta cache(ret=-4002, key={tenant_id:2529341, phy_addr:588575-588576-0-2305843216447181485-0}, value={type:3, obj:0xffec50088090}, cache_value=0xffec50dcb2b0)

```

## 关键核心信息

### 触发条件

tenant_id 过大。

## 问题的风险及影响

不能成功创建租户。

## 影响租户

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

## 适用版本

OceanBase 数据库 V4.x 版本。

## 解决方法

1. 当出现类似问题时，一定不要重启机器，先确认是否是 tenant_id 过大导致的问题。
 2. 单副本集群没有容灾能力，只能替换带上修复的 binary。由于此时其他租户的大部分功能还能够正常使用，因此可以凑合着用用，等拿到修复版本之后再替换 binary 拉起。
 3. 多副本集群，可以通过 `ALTER SYSTEM SWITCH REPLICA leader LS = 1 SERVER = 'xxx.xxx.xxx.xxx:xxxx' TENANT='sys';` 切 RS。
 4. 此时无论单副本和多副本集群 RS 上的 DDL 服务应该都是正常的，执行 `drop tenant force` 将问题租户删除。
 5. 通过 `select tenant_id from oceanbase.__all_tenant_history;` 确定历史上存在的上一个最大合法 tenant_id 为 $tenant_id。
 6. 修改 `update __all_tenant_history set tenant_id = $tenant_id +1 where tenant_id = $invalid_meta_tenant_id；update __all_tenant_history set tenant_id = $tenant_id +2 where tenant_id = $invalid_user_tenant_id;` 注意，OceanBase 数据库 V4.x 版本存在 meta 租户，tenant_id 过大的用户租户和 meta 租户的 tenant_id 都要分别进行修改。
 7. 修改 `__all_sys_stat`，`update __all_sys_stat set value = "$tenant_id+3" where name = "ob_max_used_tenant_id";`。
 8. 可以新建租户验证 tenant_id 是否已经恢复正常。

## 规避方式

1. `select value from __all_sys_stat where name = "ob_max_used_tenant_id";` 当该值较大时，通过上述**解决方法** 这节中的 5，7 进行恢复。
 2. 对创建租户的行为进行限制，特别是不要重复创建明确会因为非语法问题创建失败的的租户。

Previous

[通过 SQL 语句调整 OceanBase 数据库 V3.x 版本租户资源规格](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000001687222)

Next

[变更租户 CPU 规格后 cpu.cfs_quota_us 不生效](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003891770) ![有帮助](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) 咨询热线
