perfino

perfino startup error; possible corrupted H2 database


Looks like something got corrupted with our H2 database. Here is the output of server.log upon startup. Is there any way to recover the data, or are we better off starting fresh?

2018-02-26 13:24:03,867 INFO  [main] server: Starting server
2018-02-26 13:24:04,602 INFO  [main] server: Starting database in directory E:\ProgramData\perfino
2018-02-26 13:24:05,381 ERROR [main] server: Cannot connect to database or access schema version
org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowcount remaining=1 SYS" [50000-176]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:167)
    at org.h2.message.DbException.convert(DbException.java:294)
    at org.h2.engine.Database.openDatabase(Database.java:291)
    at org.h2.engine.Database.<init>(Database.java:254)
    at org.h2.engine.Engine.openSession(Engine.java:57)
    at org.h2.engine.Engine.openSession(Engine.java:164)
    at org.h2.engine.Engine.createSessionAndValidate(Engine.java:142)
    at org.h2.engine.Engine.createSession(Engine.java:125)
    at org.h2.engine.Engine.createSession(Engine.java:27)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:331)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
    at org.h2.Driver.connect(Driver.java:74)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.perfino.c.a.a(ejt:207)
    at com.perfino.c.a.a(ejt:138)
    at com.perfino.server.ServerMain.main(ejt:248)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:65)
    at com.exe4j.runtime.WinLauncher$2.run(WinLauncher.java:96)
Caused by: java.lang.RuntimeException: rowcount remaining=1 SYS
    at org.h2.message.DbException.throwInternalError(DbException.java:241)
    at org.h2.table.RegularTable.addIndex(RegularTable.java:284)
    at org.h2.engine.Database.open(Database.java:705)
    at org.h2.engine.Database.openDatabase(Database.java:260)
    ... 21 more

Solution

  • There is no data recovery tool for H2. If you have a backup of the database, I would recommend switching to the backup.

    To reset the database, go to the database directory and remove the files perfino.h2.db and perfino.trace.db while the server is stopped.

    The configuration data is located in config.h2.db and will be preserved.