Loading...

h2-database@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Corrupted Database Help Thomas Mueller Mon May 25 12:00:53 2009

Hi,

Sorry for the delay. It looks like this user uses an older version of
H2, version 1.0.72 from 2008-05-10 (the second exception message says
[50000-72]; the -72 of this code is the build number). Since then, a
bug that could cause such problems was solved: in version 1.1.108
(2009-02-28), "When the shutdown hook closed the database, the last
log file was deleted too early. This could cause uncommitted changes
to be persisted. In some cases, this could cause data corruption.".
For the complete list of changes, see also
http://www.h2database.com/html/changelog.html

You probably need to use the Recovery tool to fix this database. See
http://www.h2database.com/html/advanced.html#using_recover_tool for
how to use it.

I do have a few more questions:

- What is your database URL?
- Do you use Tomcat or another web server? Do you unload or reload the
web application?
- You can find out if the database is corrupted when running
    SCRIPT TO 'test.sql'
- Did you use multiple connections?
- The first workarounds is: append ;RECOVER=1 to the database URL.
    Does it work when you do this?
- The second workarounds is: delete the index.db file
    (it is re-created automatically) and try again. Does it work when
you do this?
- The third workarounds is: use the tool org.h2.tools.Recover to create
    the SQL script file, and then re-create the database using this script.
    Does it work when you do this?
- With which version of H2 was this database created?
    You can find it out using:
    select * from information_schema.settings where name='CREATE_BUILD'
- Do you use any settings or special features (for example, the setting LOG=0,
    or two phase commit, linked tables, cache settings)?
- Is the application multi-threaded?
- What operating system, file system, and virtual machine
    (java -version) do you use?
- Is it (or was it at some point) a networked file system?
- How big is the database (file sizes)?
- Is the database usually closed normally, or is process terminated forcefully
    or the computer switched off?
- Is it possible to reproduce this problem using a fresh database
    (sometimes, or always)?

Regards,
Thomas



On Mon, May 18, 2009 at 12:31 PM, ianhannaford <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a user that constantly experiences a problem with their
> database. The error they are getting is the following:
>
> org.h2.jdbc.JdbcSQLException: General error:
> java.lang.RuntimeException: File ID mismatch got=0 expected=110
> pos=11712 false org.h2.store.DiskFile:C:\Window Cleaner Pro\db
> \wcp.index.db blockCount:0 [50000-111]
>  at org.h2.message.Message.getSQLException(Message.java:107)
>  at org.h2.message.Message.convert(Message.java:279)
>  at org.h2.table.TableData.addRow(TableData.java:137)
>  at org.h2.log.UndoLogRecord.undo(UndoLogRecord.java:118)
>  at org.h2.engine.Session.rollbackTo(Session.java:526)
>  at org.h2.command.Command.executeUpdate(Command.java:254)
>  at org.h2.server.TcpServerThread.process(TcpServerThread.java:297)
>  at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
>  at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.RuntimeException: File ID mismatch got=0
> expected=110 pos=11712 false org.h2.store.DiskFile:C:\Window Cleaner
> Pro\db\wcp.index.db blockCount:0
>  at org.h2.message.Message.throwInternalError(Message.java:187)
>  at org.h2.store.DiskFile.getRecord(DiskFile.java:579)
>  at org.h2.store.Storage.getRecord(Storage.java:94)
>  at org.h2.index.BtreeIndex.getPage(BtreeIndex.java:181)
>  at org.h2.index.BtreeNode.add(BtreeNode.java:104)
>  at org.h2.index.BtreeIndex.add(BtreeIndex.java:223)
>  at org.h2.table.TableData.addRow(TableData.java:119)
>  ... 6 more
>  at org.h2.engine.SessionRemote.done(SessionRemote.java:525)
>  at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:193)
>  at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:164)
>  at snaq.db.CachedStatement.execute(CachedStatement.java:201)
>
> I have tried to rebuild the database from scratch using SQL statements
> but the problem still occurs. It seems to be very intimitent. I have
> also tried deleting the index and log files to no avail.
>
> Here is another sample of the kind of errors this user gets:
>
> com.truecommerce.exceptions.unchecked.UncheckedException:
> com.truecommerce.exceptions.checked.FailedException:
> org.h2.jdbc.JdbcSQLException: General error: java.lang.Error: File ID
> mismatch got=0 expected=172 pos=11520 false org.h2.store.DiskFile:C:
> \Window Cleaner Pro\db\wcp.index.db blockCount:0 [50000-72]
> at org.h2.message.Message.getSQLException(Message.java:92)
> at org.h2.message.Message.convert(Message.java:175)
> at org.h2.table.TableData.addRow(TableData.java:116)
> at org.h2.command.dml.Insert.update(Insert.java:96)
> at org.h2.command.CommandContainer.update(CommandContainer.java:69)
> at org.h2.command.Command.executeUpdate(Command.java:198)
> at org.h2.server.TcpServerThread.process(TcpServerThread.java:279)
> at org.h2.server.TcpServerThread.run(TcpServerThread.java:126)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.Error: File ID mismatch got=0 expected=172
> pos=11520 false! org.h2.store.DiskFile:C:\Window Cleaner Pro\db
> \wcp.index.db blockCount:0
> at org.h2.message.Message.getInternalError(Message.java:129)
> at org.h2.store.DiskFile.getRecord(DiskFile.java:507)
> at org.h2.store.Storage.getRecord(Storage.java:66)
> at org.h2.index.BtreeIndex.getPage(BtreeIndex.java:142)
> at org.h2.index.BtreeNode.add(BtreeNode.java:99)
> at org.h2.index.BtreeNode.add(BtreeNode.java:100)
> at org.h2.index.BtreeIndex.add(BtreeIndex.java:179)
> at org.h2.table.TableData.addRow(TableData.java:98)
>
> Any help or advice would be most appreciated.
>
> Thanks
>
> Ian
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---