本文介绍了h2.db文件不断增长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用嵌入在应用程序中的H2数据库(持久性).

We're using H2 database (persistent) embedded within our application.

即使我们删除了表,h2.db文件仍在不断增长.

Even after we delete the tables, the h2.db file keeps growing.

我们尝试禁用事务隔离(LOCK_MODE = 0),禁用查询日志(TRACE_LEVE_FILE = 0),禁用撤消日志,但没有任何帮助.

We tried disabling transaction isolation (LOCK_MODE=0), disabled the query log (TRACE_LEVE_FILE=0), disabled the undo log, but nothing helps.

紧凑是唯一的选择吗?压缩将需要重新启动数据库,而我们不能这样做.

Is compacting the only option? Compacting will need restart of the DB which we cannot do.

推荐答案

此问题已解决.问题是我们正在使用存储在 servlet上下文中的连接.此连接从未关闭.我们更改了代码以自行管理连接,并在删除表(并重新打开)之后关闭了连接.

This issue got resolved. The issue was we were using connection stored in the servlet context. This connection was never closed. We changed the code to manage connections ourselves and close connections after tables are dropped (and reopen).

这篇关于h2.db文件不断增长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 10:21