You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Thomas J. Taylor" <Th...@INFOTECHSoft.com> on 2008/02/01 18:06:09 UTC

Recovering from 'Failed to Start Database'

Hello,

I have an 800MB derby database that has suddenly stopped working, giving an
SQLException - "Failed to start database" when started from my code and
SQuirreL (see first stack trace). I get a different error when I try to
start the database through IJ (see second stack trace): "ERROR XSDG3:
Meta-data for Container ...RAFContainer@c8f6f8 could not be accessed"

Does anyone know how I can recover this database?

Thanks in advance.

Thomas Taylor
INFOTECH Soft, Inc.

System Details:
Derby: 10.2.2.0
  O/S: Windows Vista and Windows XP
  JVM: jre 1.6.0-oem-b104 and jre 1.5.0_04

*****************************
BEGIN STACKTRACE FOR SQuirreL
----------------------------------------------------------------
java.sql.SQLException: Failed to start database 'C:/derby-dbs/error-db', see
the next exception for details.
	at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
Source)
	at
org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown
Source)
	at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown
Source)
	at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
	at org.apache.derby.jdbc.EmbeddedDriver.connect(Unknown Source)
	at
net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriver
Manager.java:133)
	at
net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.e
xecute(OpenConnectionCommand.java:97)
	at
net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand$S
heetHandler.run(ConnectToAliasCommand.java:279)
	at
net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Failed to start database
'C:/derby-dbs/error-db', see the next exception for details.
	at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
	at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossD
RDA(Unknown Source)
	... 17 more



**********************
BEGIN DERBY LOG FOR IJ
----------------------------------------------------------------
2008-02-01 16:48:39.350 GMT:
 Booting Derby version The Apache Software Foundation - Apache Derby -
10.2.2.0 - (485682): instance a816c00e-0117-d5e3-b7ee-00000047f408
on database directory C:\derby-dbs\error-db  


------------  BEGIN SHUTDOWN ERROR STACK -------------

ERROR XSDG3: Meta-data for Container
org.apache.derby.impl.store.raw.data.RAFContainer@c8f6f8 could not be
accessed
	at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.apache.derby.impl.store.raw.data.RAFContainer.openContainer(Unknown
Source)
	at
org.apache.derby.impl.store.raw.data.FileContainer.setIdent(Unknown Source)
	at
org.apache.derby.impl.store.raw.data.RAFContainer.setIdentity(Unknown
Source)
	at
org.apache.derby.impl.services.cache.CachedItem.takeOnIdentity(Unknown
Source)
	at org.apache.derby.impl.services.cache.Clock.addEntry(Unknown
Source)
	at org.apache.derby.impl.services.cache.Clock.find(Unknown Source)
	at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unkno
wn Source)
.
.
.
	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown
Source)
	at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown
Source)
	at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown
Source)
	at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
	at org.apache.derby.tools.ij.main(Unknown Source)
============= begin nested exception, level (1) ===========
java.io.EOFException
	at java.io.RandomAccessFile.readFully(Unknown Source)
	at java.io.RandomAccessFile.readFully(Unknown Source)
	at
org.apache.derby.impl.store.raw.data.FileContainer.getEmbryonicPage(Unknown
Source)
	at
org.apache.derby.impl.store.raw.data.FileContainer.readHeader(Unknown
Source)
	at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown
Source)
	at java.security.AccessController.doPrivileged(Native Method)
.
.
.
	at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown
Source)
	at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown
Source)
	at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown
Source)
	at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
	at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
	at org.apache.derby.tools.ij.main(Unknown Source)
============= end nested exception, level (1) ===========
------------  END SHUTDOWN ERROR STACK -------------


2008-02-01 16:48:39.366 GMT:
Shutting down instance a816c00e-0117-d5e3-b7ee-00000047f408
----------------------------------------------------------------



RE: Recovering from 'Failed to Start Database'

Posted by "Thomas J. Taylor" <Th...@Miami.edu>.
Hi Knut,

Thank you for the links - I managed to get the Derby database to boot by
deleting the \log\log1.dat file. 

After that, I was able to access all but one table. However, if I tried to
access the table (SELECT, DROP, etc.) all subsequent queries would fail.

I deleted a \seg0\XXX.dat file that corresponded to the data in the table,
which allowed me to continue using the database, even after accessing the
corrupt table... The table still shows in the database schema, but I was
able to copy the rest of the contents of the database to another database.

In the end, I was able to recover everything except for the data in the
corrupted table.

Thomas


"Thomas J. Taylor" <Th...@INFOTECHSoft.com> writes:

> Hello,
>
> I have an 800MB derby database that has suddenly stopped working, giving
an
> SQLException - "Failed to start database" when started from my code and
> SQuirreL (see first stack trace). I get a different error when I try to
> start the database through IJ (see second stack trace): "ERROR XSDG3:
> Meta-data for Container ...RAFContainer@c8f6f8 could not be accessed"

Hi Thomas,

Similar errors have been reported before. See for instance

https://issues.apache.org/jira/browse/DERBY-2589
https://issues.apache.org/jira/browse/DERBY-3052
https://issues.apache.org/jira/browse/DERBY-3143
https://issues.apache.org/jira/browse/DERBY-3344

Unfortunately, no one has come up with an explanation yet.

> Does anyone know how I can recover this database?

It sounds like the database has been corrupted, so I'm afraid recovery
from backup is the only reliable way to do it.

-- 
Knut Anders



Re: Recovering from 'Failed to Start Database'

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
"Thomas J. Taylor" <Th...@INFOTECHSoft.com> writes:

> Hello,
>
> I have an 800MB derby database that has suddenly stopped working, giving an
> SQLException - "Failed to start database" when started from my code and
> SQuirreL (see first stack trace). I get a different error when I try to
> start the database through IJ (see second stack trace): "ERROR XSDG3:
> Meta-data for Container ...RAFContainer@c8f6f8 could not be accessed"

Hi Thomas,

Similar errors have been reported before. See for instance

https://issues.apache.org/jira/browse/DERBY-2589
https://issues.apache.org/jira/browse/DERBY-3052
https://issues.apache.org/jira/browse/DERBY-3143
https://issues.apache.org/jira/browse/DERBY-3344

Unfortunately, no one has come up with an explanation yet.

> Does anyone know how I can recover this database?

It sounds like the database has been corrupted, so I'm afraid recovery
from backup is the only reliable way to do it.

-- 
Knut Anders