Corrupt Database Chunk Wont Recover

623 views
Skip to first unread message

Coleman Yantis

unread,
Jul 13, 2019, 2:53:06 PM7/13/19
to H2 Database
Hello,

One of my clients had their database corrupted and I've spent way too much time googling and trying to find a solution on how to repair it. I tried using the Recover tool but it just stops at the broken chunk and gives this error:

Exception in thread "main" java.lang.IllegalStateException: File corrupted in chunk 232960, expected page length 4..3072, got 0 [1.4.199/6]
        at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883)
        at org.h2.mvstore.MVStore.readBufferForPage(MVStore.java:1055)
        at org.h2.mvstore.MVStore.readPage(MVStore.java:2186)
        at org.h2.mvstore.MVMap.readPage(MVMap.java:554)
        at org.h2.mvstore.Page$NonLeaf.getChildPage(Page.java:1086)
        at org.h2.mvstore.Cursor.traverseDown(Cursor.java:165)
        at org.h2.mvstore.Cursor.<init>(Cursor.java:31)
        at org.h2.mvstore.Cursor.<init>(Cursor.java:27)
        at org.h2.mvstore.MVMap.cursor(MVMap.java:660)
        at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:792)
        at org.h2.mvstore.MVStore.<init>(MVStore.java:401)
        at org.h2.mvstore.MVStore$Builder.open(MVStore.java:3343)
        at org.h2.mvstore.MVStoreTool.info(MVStoreTool.java:347)
        at org.h2.tools.Recover.process(Recover.java:344)
        at org.h2.tools.Recover.runTool(Recover.java:195)
        at org.h2.tools.Recover.main(Recover.java:158)

Is there a way to bypass this? I've seen posts alluding to such a method existing but none explaining how it could be done.

Noel Grandin

unread,
Jul 13, 2019, 4:06:17 PM7/13/19
to h2-da...@googlegroups.com
Your best bet involves building your own copy of H2 and selectively disabling the chunks of code that are throwing exceptions.

That is however, an error right near the beginning when the critical metadata structures are being loaded, so I wouldn't hold out a lot of hope of getting much data back.

Coleman Yantis

unread,
Jul 13, 2019, 10:29:08 PM7/13/19
to H2 Database
Ive commented out the errors but I am stuck on how to build the jar. I tried running the pom and build files yet none want to work.

Evgenij Ryazanov

unread,
Jul 14, 2019, 12:08:45 AM7/14/19
to H2 Database
Building instructions are here:
https://h2database.com/html/build.html#building

However, you you can load the sources from h2/src/main into any Java IDE and launch the recovery process directly from the IDE. When you see a failure that isn't handled automatically you can add some try-catch blocks to the code and run the recovery process again.

Andrei Tokar

unread,
Jul 14, 2019, 5:35:34 PM7/14/19
to H2 Database
Please see attached my take on that recovery (after a few hacks in source code).
mcrpg.recovered.zip

Coleman Yantis

unread,
Jul 15, 2019, 10:07:02 AM7/15/19
to h2-da...@googlegroups.com
Attempted to convert it to a mv.db file and then when loaded got this

15.07 09:05:09 [Server] WARN Caused by: java.lang.IllegalStateException: Store header is corrupt: nio:/plugins/McRPG/database/mcrpg.mv.db [1.4.198/6]  

On Sun, Jul 14, 2019 at 4:35 PM Andrei Tokar <andrei...@gmail.com> wrote:
Please see attached my take on that recovery (after a few hacks in source code).

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/36d00b37-fb1c-4860-8fc4-2807649ccb62%40googlegroups.com.

Silvio

unread,
Jul 15, 2019, 10:29:51 AM7/15/19
to H2 Database
Try to run the Recover tool from H2 version 196 or 197. I regularly deal with corrupted databases since moving to 199 and in 9 out of 10 cases the older Recover tool works where the one in 199 will not. This does not only hold for the Recover tool since 196/197 usually open my "corrupted" databases without issues.

To make sure you do not run into compatibility issues between versions also use the RunScript from the older version to create a new database. Until now I had no issues in opening these with 199.

Coleman Yantis

unread,
Jul 15, 2019, 11:40:29 AM7/15/19
to h2-da...@googlegroups.com
How do you find those older jars?

On Mon, Jul 15, 2019 at 9:29 AM Silvio <sbie...@jambo-software.com> wrote:
Try to run the Recover tool from H2 version 196 or 197. I regularly deal with corrupted databases since moving to 199 and in 9 out of 10 cases the older Recover tool works where the one in 199 will not. This does not only hold for the Recover tool since 196/197 usually open my "corrupted" databases without issues.

To make sure you do not run into compatibility issues between versions also use the RunScript from the older version to create a new database. Until now I had no issues in opening these with 199.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.

Andrei Tokar

unread,
Jul 16, 2019, 8:02:58 PM7/16/19
to H2 Database

So you did not like whatever I've recovered? I doubt that there is any more data in this file.

Silvio

unread,
Jul 17, 2019, 2:32:17 AM7/17/19
to H2 Database
107 is on the download page. That one should work also. I still have 196 from before. Perhaps the H2 guys can help you with that.

Silvio

unread,
Jul 17, 2019, 2:33:26 AM7/17/19
to H2 Database
197...
Reply all
Reply to author
Forward
0 new messages