
Corrupt Piggydb database
Reported by Sefan Sultanov | March 17th, 2017 @ 03:13 PM
Hi,
My PiggyDB server refuses to start with the corrupt Piggydb file.
The error message is as follows:
ERROR 2017/03/17 15:05:20
javax.servlet.UnavailableException:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could
not get JDBC Connection; nested exception is
org.h2.jdbc.JdbcSQLException: File corrupted while reading record:
"[8] stream data key:29 pos:11 remaining:0". Possible solution: use
the recovery tool [90030-145]
javax.servlet.UnavailableException:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could
not get JDBC Connection; nested exception is
org.h2.jdbc.JdbcSQLException: File corrupted while reading record:
"[8] stream data key:29 pos:11 remaining:0". Possible solution: use
the recovery tool [90030-145]
at
org.eclipse.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:394)
at
org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:439)
at
org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:245)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:694)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:193)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:966)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:349)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
at org.eclipse.jetty.server.Server.doStart(Server.java:230) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
marubinotto.piggydb.standalone.PiggydbServer.launch(PiggydbServer.java:83)
at
marubinotto.piggydb.standalone.PiggydbServer.main(PiggydbServer.java:48)
Unfortunately there is no way I could recover the database as no
backups were made. Lame. Please help!
I tried to recreate the piggydb folder and it works, but as soon as
I replace the h2.db file with the corrupt one, it refuses to
work.
Comments and changes to this ticket
-
marubinotto March 20th, 2017 @ 08:06 AM
Hi Sefan,
You can probably recover your data by using the recovery tool provided by H2 database.
http://www.h2database.com/html/advanced.html#using_recover_tool
The followings are the steps to recover your data:
1) First, stop your piggydb server.
2) Copy the files named like
h2*.jar
fromwebapp/WEB-INF/lib
to your database directory (~/piggydb/
by default).3) Execute the command below in the database directory:
java -cp h2*.jar org.h2.tools.Recover
This command will produce a file named
piggydb.data.sql
by which you can restore your database.4) Delete all the lines that contain
CJKFullText
frompiggydb.data.sql
because they will cause an error when executing.5) Move all the old database files (*.db) to another place for backup.
6) Execute the commands below:
java -cp h2*.jar org.h2.tools.RunScript -url jdbc:h2:~/piggydb/piggydb -user sa2 -script piggydb.data.sql -showResults
7) Start your piggydb and check the content.
I hope this works for you.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Piggydb is a Web notebook application that provides you with a platform to build your knowledge personally or collaboratively.