---
title: OCP Web 界面上的【SQL诊断】遇到了报错：No memory or reach tenant memory limit 的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于OCP Web 界面上的【SQL诊断】遇到了报错：No memory or reach tenant memory limit 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决OCP Web 界面上的【SQL诊断】遇到了报错：No memory or reach tenant memory limit 的原因和解决方法的难题。
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)划线反馈

# OCP Web 界面上的【SQL诊断】遇到了报错：No memory or reach tenant memory limit 的原因和解决方法

更新时间：2026-07-08 08:01

适用版本： V1.x、V2.x、V3.x、V4.x 内容类型：Troubleshoot  

## 问题现象

在使用 OCP Web 界面提供的【SQL诊断】功能时遇到了报错：`Unhandled exception, type=TransientDataAccessResourceException, message= ### Error querying database. Cause: java.sql.SQLTransientConnectionException: (conn=402931) No memory or reach tenant memory limit`，如下图所示。

![image](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/ocp/20250915sql-diagnostics-window-ocp-web-interface-displays-error-no-memory-or-reach-tenant-memory-limit.png)

## 问题原因

通过分析相关报错，发现是 OCP 在执行 `select ... from ob_hist_sql_audit_stat_0 where ...` 这条复杂的查询 SQL 时遇到了内存不足的报错：`No memory or reach tenant memory limit` 该报错在 OceanBase 中对应的错误码为：

```shell
OceanBase Error Code: OB_ALLOCATE_MEMORY_FAILED(-4013)
Message: No memory or reach tenant memory limit
Cause: Internal Error

```

-4013 报错是除了 MemStore 之外的某个模块的内存不够了，最常见的就是 `sql_work_area` 不足，或者 `KVCache` 内存不足，或者编译和执行模块 `SqlExecutor` 内存不足。这边对应的查询 SQL 语句是发送到 OCP Web 使用的 MetaDB 元数据库集群中的 OCP Monitor 租户内的 `ob_hist_sql_audit_stat_0` 表上进行查询的。

## 问题的风险及影响

无法使用 OCP 产品提供的【SQL诊断】功能。

## 适用版本

OCP 所有版本。

## 解决方法

- **方法一）：** 调大对应 OCP Monitor 租户的内存规格（如果 MetaDB 集群的剩余空闲 Memory 资源不足，还需要先通过 OAT 来调大 MetaDB 组件的 Memory 规格）。
 - **方法二）：** 调大对应 OCP Monitor 租户的全局变量 `ob_sql_work_area_percentage`。

  ```shell
  [root@metadb ~]# mysql -hxxx.xxx.xxx.xxx -P2881 -uroot@ocp_monitor_meta -pxxx
  Welcome to the MariaDB monitor.  Commands end with ; or \g.
  Your MySQL connection id is 3221544712
  Server version: 5.7.25 OceanBase 4.2.1.7 (r107030032024062709-7d62d41478c39e4512cd694d1019a69dcc7efb63) (Built Jun 27 2024 10:13:11)

  Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  MySQL [(none)]> show variables like 'ob_sql_work%';
  +-----------------------------+-------+
  | Variable_name               | Value |
  +-----------------------------+-------+
  | ob_sql_work_area_percentage | 5     |
  +-----------------------------+-------+
  1 row in set (0.003 sec)

  MySQL [(none)]> set global ob_sql_work_area_percentage=80; -- 一般调整到 80 即可，默认值：5
  Query OK, 0 rows affected (0.060 sec)

  ```

## 规避方式

无。

上一篇

[如何限制 OceanBase 集群的流量](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000224691)

下一篇

[OCP Web 上的 Active agent modules 子任务遇到报错：java.net.SocketTimeoutException: Read timed out 的原因和解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003187188) ![有帮助](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) 咨询
