I'm using h2-1.3.155 in embedded mode with Spring/Hibernate in a Java/Swing client app running on WinXP SP3 with the startup params : IFEXISTS=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=5. I have several corrupted databases on different tablets where I am either no longer able to query against some or all of the database and sometimes cannot access it at all. Looking at the one with partial access, the trace file initially contains the following error:
08-20 04:37:48 database: close
org.h2.message.DbException: IO Exception: "java.io.EOFException"; "C:\journal\H2DB\HNDLDATA.h2.db" [90031-155]
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.message.DbException.convertIOException(DbException.java:313)
at org.h2.store.FileStore.readFully(FileStore.java:287)
at org.h2.store.PageStore.readPage(PageStore.java:1247)
at org.h2.store.PageStore.getPage(PageStore.java:701)
at org.h2.store.PageStreamTrunk$Iterator.next(PageStreamTrunk.java:247)
at org.h2.store.PageLog.free(PageLog.java:210)
at org.h2.store.PageStore.compact(PageStore.java:583)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:1125)
at org.h2.engine.Database.close(Database.java:1076)
at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:80)
Caused by: org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.EOFException"; "C:\journal\H2DB\HNDLDATA.h2.db" [90031-155]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
... 11 more
Caused by: java.io.EOFException
at java.io.RandomAccessFile.readFully(Unknown Source)
at org.h2.store.FileStore.readFully(FileStore.java:285)
... 8 more
From this point forward in time, most basic queries in the H2 Console fail against the schema tables fail in one of two ways as seen below:
SELECT * FROM JESIG;
or
SELECT * FROM USER_SESSION;
As you would expect, views against these tables fail in the same way. These two exceptions are also repeated in the trace file. Running the Recovery tool, it appears to generate the SQL to recreate all objects, however it only seems to reclaim < 5% of the data and the recovery file is full of messages like this:
-- page 20: data node parent: 0 table: 18 entries: 295 rowCount: 5058
-- ERROR [20] child[0]: 63 parent: 0
-- ERROR [20] child[1]: 64 parent: 0
...
...
-- ERROR [20] child[291]: 1335 parent: 0
-- ERROR [20] child[292]: 1340 parent: 0
-- page 21: data overflow (last)
and this:
-- page 1294: data node parent: 17 table: 20 entries: 203 rowCount: -1
-- ERROR [1294] child[0]: 974 parent: 0
-- ERROR [1294] child[1]: 981 parent: 0
I could use some expert assistance in determine if there's any hope of recovering the rest of the data.
As for the cause of the corruption, logging data points to the running of a bat file to move (and subsequently replace) the db using the local Scheduled Task Manager while it was in use that is likely the culprit. This has since been disabled to say the least.
I appreciate any help in trying to recover the data.