Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 损坏的H2数据库。无法使用恢复工具进行恢复_Java_Sql_Database_H2 - Fatal编程技术网

Java 损坏的H2数据库。无法使用恢复工具进行恢复

Java 损坏的H2数据库。无法使用恢复工具进行恢复,java,sql,database,h2,Java,Sql,Database,H2,今天,我的一个H2数据库连接失败,并显示以下错误消息: Unable to obtain connection from database (jdbc:h2:file:C:\Users\Username\.appfiles\db\appdb) for user 'sa': File corrupted while reading record: null. Possible solution: use the recovery tool [90030-200] SQL State : 900

今天,我的一个H2数据库连接失败,并显示以下错误消息:

Unable to obtain connection from database (jdbc:h2:file:C:\Users\Username\.appfiles\db\appdb) for user 'sa': File corrupted while reading record: null. Possible solution: use the recovery tool [90030-200]

SQL State  : 90030
Error Code : 90030
Message    : File corrupted while reading record: null. Possible solution: use the recovery tool [90030-200]
正如我所建议的那样,我尝试按照文档的指示使用恢复工具,我执行的步骤如下:

  • 转到h2数据文件目录
  • java-cp h2-1.4.200.jar org.h2.tools.Recover
  • 使用恢复工具生成的SQL文件重新创建数据库
  • 这些步骤创建了两个文件:一个.sql和一个.txt文件,但该工具生成的sql没有来自数据库的任何数据或DDL,只有一些别名和一堆注释。这些文件的内容链接在下面,如果它们能帮助我们了解在这个过程中出现了什么问题的话

    这是.sql文件输出:

    这是.txt文件输出:

    是否有任何步骤我做得不对,或者是否有任何其他事情我可以尝试恢复此db?欢迎任何建议。

    使用

    java -cp h2-1.4.200.jar org.h2.tools.RunScript -url jdbc:h2:[path to destination db file]/[db name] -user [user] -password [password] -script [text file/sql file] java-cp h2-1.4.200.jar org.h2.tools.RunScript-url jdbc:h2:[目标数据库文件的路径]/[db name]-用户[用户]-密码[密码]-脚本[文本文件/sql文件]