---
title: 编组
description: 了解OceanBase数据库在实际应用中关于 pz_value unexpected(ret=-4016 问题相关的常见问题和使用技巧，帮助您快速解决 pz_value unexpected(ret=-4016 问题的难题。
---
切换语言

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

划线反馈

# pz_value unexpected(ret=-4016 问题

更新时间：2024-06-14 01:51

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

## 问题现象

执行 `Drop Tablegroup` 、`Drop Table`、`Drop Database` 操作失败，报错 4016。

以 `Drop Tablegroup` 为例，示例如下：

```shell
obclient> drop tablegroup TG_PZ;
ORA-00600: internal error code, arguments: -4016, Internal error

```

报错日志如下：

```shell
[2022-05-23 11:09:17.001965] WARN  [RS] try_modify_tenant_primary_zone_entity_count (ob_ddl_service.cpp:2537) [2298519][0][YB42AC14107E-0005DF6FDCD3E605-0-0] [lt=3] pz_value unexpected(ret=-4016, pz_value=0)
[2022-05-23 11:09:17.001980] WARN  [RS] drop_tablegroup (ob_ddl_service.cpp:17214) [2298519][0][YB42AC14107E-0005DF6FDCD3E605-0-0] [lt=12] fail to try dec tenant primary zone entity count(ret=-4016)

```

#### 注意

报错日志在`try_modify_tenant_primary_zone_entity_count`函数中。实际函数逻辑是检查`_primary_zone_entity_count`值不应该为 0。

## 问题原因

`_primary_zone_entity_count` 用于统计各类设置了 `primary_zone` 值的对象的个数，包括 Table、Tablegroup、Database 等。这些对象在变更过程中，如果发现新增了 `primary_zone` 或者删除了 `primary_zone` 属性，就会增加和减少`_primary_zone_entity_count` 的值。

## 影响版本

OceanBase 数据库 V3.X、V2.X 所有版本。

## 解决方法

运行以下 job 来修正值。

```shell
obclient> alter system run job 'STATISTIC_PRIMARY_ZONE_ENTITY_COUNT'

```

但是这个 job 在所有版本上存在缺陷，没有统计带有 `primary_zone` 的 Tablegroup 的对象个数，如果需要修正的对象只剩下 Tablegroup 对象，那么修正后的数据也存在问题。可以通过以下方法临时绕过。

临时绕过方案如下：

如果需要 Drop 对象，则可以新增一个带有 `primary_zone` 属性的对象，例如：

```shell
obclient> CREATE TABLEGROUP TG1 primary_zone = 'RANDOM';

```

这样，`_primary_zone_entity_count` 会变为非 0，允许 Drop 目标对象了，可以绕过该问题。

上一篇

[Location Cache 问题排查](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000903988)

下一篇

[租户分区数上限计算方式](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000990095) ![有帮助](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) 咨询热线
