如何检查h2数据库健康和损坏 [英] How to check h2 database health and corruption

查看:654
本文介绍了如何检查h2数据库健康和损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在嵌入式模式下使用h2数据库和JavaFX 8桌面应用程序,我已经为用户开发了一个备份和恢复数据库文件的选项。

I'm using h2 database in embedded mode with JavaFX 8 desktop application and I have developed an option for the user to backup and restore the database file.

In我使用SQLite数据库并使用此命令pragma integrity_check检查数据库文件的程序的旧版本非常简单。

In the older version of the program I have used SQLite database and checking the database file was quite simple using this command pragma integrity_check.

在h2数据库中使用该命令总是抛出一个例外。

Using that command with the h2 database always throws an exception.

在h2数据库中有什么替代方案?在使用之前是否有明确或更正确的方法来检查h2数据库文件?

What is the alternative for that in the h2 database? And is there an explicit or more proper way to check the h2 database file before using it?

感谢任何帮助或代码示例,谢谢。

Any help or code sample is appreciated,thanks.

推荐答案

你能做的是执行 脚本到 命令,例如压缩。如果该命令有效,那么数据库就是好的。与此同时,你有一个备份。

What you could do is execute the script to command, for example with compression. If that command works, then the database is good. At the same time, you have a backup.

这篇关于如何检查h2数据库健康和损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆