> For the complete documentation index, see [llms.txt](https://o2oa.gitbook.io/course/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://o2oa.gitbook.io/course/ping-tai-shi-shi/ping-tai-shu-ju-ku-pei-zhi/ya-suo-h2-shu-ju-ku.md).

# 压缩H2数据库

平台自带的H2数据库在使用过程中会随着数据量的增加而增长，但是并不会在删除数据后自动缩小。所以O2OA提供了数据库压缩命令用于缩小数据库占用的空间。

操作命令说明

```
compact data passwd
```

{% hint style="info" %}

#### 其中passwd 是xadmin密码。压缩数据库时，请不要启动数据库。

{% endhint %}

执行压缩命令

数据库压缩命令：compact data o2，其中o2是平台默认的xadmin密码。

{% hint style="info" %}

#### 如果密码已经修改过了，请使用新的密码。

{% endhint %}

![正在压缩数据库](https://3148786149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmN_rNQCcekD6lUTyjN%2F-LpRsFBomUr-1DXlrOyS%2F-LpRt8Hd0W_lued_m_cv%2F5.png?alt=media\&token=bfe56ee6-6376-4d14-9321-6bd2f8d6c2e4)

压缩时间由数据量大小而定。

![数据库压缩完成](https://3148786149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmN_rNQCcekD6lUTyjN%2F-LpRsFBomUr-1DXlrOyS%2F-LpRtIRRZXOfxkTGT0EW%2F6.png?alt=media\&token=d41e31d1-47d4-45e4-9b26-5769e71a9df4)

压缩完成后，H2数据库文件会有一定的缩小。&#x20;

{% hint style="info" %}

#### 数据库文件路径：o2server\local\repository\data\X.mv.db

{% endhint %}
