---
title: 子查询过滤条件为分区键 SQL 报错 -4016 can not find part expr 的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于 子查询过滤条件为分区键 SQL 报错 -4016 can not find part expr 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决 子查询过滤条件为分区键 SQL 报错 -4016 can not find part expr 的原因和解决方法的难题。
---
切换语言

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

划线反馈

# 子查询过滤条件为分区键 SQL 报错 -4016 can not find part expr 的原因和解决方法

更新时间：2026-05-14 07:41

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

## 问题现象

在 OceanBase 数据库集群执行执行 SQL 报错 `ORA-00600: internal error code, arguments: -4016, Internal error` 无法查看执行计划，在计划生产阶段就报错，无法通过加 `/*+ NO_REWRITE */` Hint 方式规避。

## 关键诊断信息

1. 报错的 SQL 是关联子查询并且子查询的基表是二级分区的分区表，有两个分区键，一个分区键在子查询中为常量 `(tmp.month_id = 202405)`，一个为关联子查询的关联列 `(and tmp.client_id = t3.client_id)` 图片字体绿色区域为关联子查询，红色区域字体过滤条件为分区键。

   ![image02](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/performance/20250618subquery-filter-condition-is-partition-key-sql-error-4016-cannot-find-part-expr02.png)
 2. 执行报错 `ORA-00600: internal error code, arguments: -4016, Internal error`。

   ![image03](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/performance/20250618subquery-filter-condition-is-partition-key-sql-error-4016-cannot-find-part-expr03.png)
 3. 查询报错 SQL 的 trace 日志 `grep 'can not find part expr'` 在 `get_repartition_keys` 有 4016 的报错。

   ![image04](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/performance/20250618subquery-filter-condition-is-partition-key-sql-error-4016-cannot-find-part-expr04.png)
 4. 使用 `/*+USE_DAS(TABLE_NAME)*/` Hint 规避后执行成功，可以判断命中此问题。

   ![image05](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/performance/20250618subquery-filter-condition-is-partition-key-sql-error-4016-cannot-find-part-expr05.png)

## 问题原因

报错 SQL 是一个关联子查询，子查询查询表为一个二级分区有两列分区键 `(month_id)` 和 `(client_id)`，其中一个分区键在子查询中为常量 `(tmp.month_id = 202405)`，一个为关联子查询的关联列 `(and tmp.client_id = t3.client_id)`， 改 SQL 生成 `sunplan filter` 的 `partition key` 计划时，无法转换为来自子查询上层表的列，代码逻辑没有做相应处理，触发报错。

![image01](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/performance/20250618subquery-filter-condition-is-partition-key-sql-error-4016-cannot-find-part-expr01.png)

```Shell
CREATE TABLE "T_1" (
  "MONTH_ID" NUMBER(10),
  "CLIENT_ID" VARCHAR2(18),
  "VALID_CLIENT" VARCHAR2(1)
) COMPRESS FOR ARCHIVE REPLICA_NUM = 3 BLOCK_SIZE = 16384
 partition by hash("CLIENT_ID") subpartition by range("MONTH_ID") subpartition template (
subpartition "P202406" values less than (202407),
subpartition "P202407" values less than (202408))
(partition "P01",
partition "P02",
partition "P03")

SELECT
 t3.CLIENT_ID AS "clientId",
 (
   SELECT
     tmp.valid_client
   FROM
     T_1 tmp
   WHERE
     tmp.month_id = 202405
     and tmp.client_id = t3.client_id
 ) AS "validClientKey"
 from T_1 t3;

```

## 问题的风险及影响

SQL 执行报错或者 EXPLAIN SQL 报错。

## 影响租户

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

## 适用版本

OceanBase 数据库 V4.x 版本。

## 解决方法

升级至问题已修复版本。目前已修复的版本包括 OceanBase 数据库 V4.2.3（oceanbase-4.2.3.0-100000052024041220）版本、V4.3.0（oceanbase-4.3.0.0-100010022024022718）版本。

## 规避方式

子查询里加 `/*+USE_DAS(TABLE_NAME)*/` Hint 规避。

上一篇

[Oceanbase 数据库 V4.x 版本，对于无主键表分区键默认不参与抽取 Query Range](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003132043)

下一篇

[Nest-Loop Join 与 Subplan Filter 的性能优化](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003161980) ![有帮助](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) 咨询热线
