Corrupted databases with 1.4.199

61 views
Skip to first unread message

kanchan jondhale

unread,
Jan 3, 2022, 5:07:00 AM1/3/22
to H2 Database

We are using Atlassian bamboo tool for build management and using embedded database.

We are getting below error while running the bamboo, looks like database is corrupted.

 

Logs:

IllegalStateException: Reading from nio:/srv/bamboo-home/database/h2.mv.db failed; file length 255352832 read length 2048 at 266538251 [1.4.199/1]

 

Can you please help here to recover it. 

kanchan jondhale

unread,
Jan 3, 2022, 5:07:22 AM1/3/22
to h2-da...@googlegroups.com
Hi,

 

We are using Atlassian bamboo tool for build management and using embedded database.

We are getting below error while running the bamboo, looks like the database is corrupted.

Silvio

unread,
Jan 3, 2022, 12:30:16 PM1/3/22
to H2 Database
Download H2 1.4.196 and try to do a record of the database with that by running

java -cp h2-1.4.196.jar org.h2.tools.Recover

from the same directory as a copy of the database file. For me this works in 90% of all cases. If it does not and an exception is thrown then you are out of luck. Otherwise do

mv database.mv.db database.mv.db.backup
java -cp h2-1.4.196.jar org.h2.tools.RunScript -url jdbc:h2:./database -script database.h2.sql

This should give you a readable version of the database.

Assuming you are on Linux or similar. Otherwise do some Windows-equivalent of this.

The reason this usually works is a bit unclear to me. It seems like 197 and later do some extra validation or throw an exception on an error state that was ignored before. Therefore the same process will usually not work with newer H2 versions. I have never had issues using the resulting 196-created database with 199 or 200.

Silvio

Reply all
Reply to author
Forward
0 new messages