---
title: 如何手工 Flush KV Cache-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于 如何手工 Flush KV Cache相关的常见问题和使用技巧，帮助您快速解决 如何手工 Flush KV Cache的难题。
---
切换语言

- 简体中文
- English

划线反馈

# 如何手工 Flush KV Cache

更新时间：2026-05-08 08:11

适用版本： V2.1.x、V2.2.x、V3.1.x、V3.2.x、V4.0.x、V4.1.x、V4.2.x 内容类型：How-to  

本文主要介绍手工清理指定 cache 的方法。

## 适用版本

OceanBase 数据库所有版本。

## 操作步骤

手动 flush cache 表示手动清理指定 cache，命令格式如下。需要先直连要 flush cache 的 OBServer 并且只能在 sys 租户下执行。

```
alter system flush kvcache tenant [tenant_name] cache '[cache_name]';

```

`cache_name` 可以在 `__all_virtual_kvcache_info` 中查到，常用的 `cache_name` 包括 `user_block_cache`、`index_block_cache`、`user_row_cache`、`fuse_row_cache`、`bf_cache` 等。

#### 注意

- V4.0 版本及以后，flush 包含了立即清空的功能，预期情况下，flush 之后 cache 应该是立即被清空。如果发生 4274 的报错，是 cache 较多导致的超时问题，再次 flush 即可。
 - V4.0 版本之前，手动 flush 只会清除指定 cache 中 kv 的索引，索引删除后，对应的 kv 就无法再被访问到，其所在的 memblock 的热度就会持续降低，等待 wash 线程将其 wash 出去。

Previous

[如何定位占用 cache 较大的 SQL](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000209949)

Next

[如何确定 Plan Cache 的淘汰机制是否正常](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000366643) ![有帮助](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) 咨询热线
