Subject Re: [firebird-support] Re: Database error
Author Ann W. Harrison
Alex (Breko) wrote:

> I received some instructions from Ms. Ann and this is what she told me to
> do:
>
> "What you're going to need is a working database created
> by the same version of Firebird where gstat -h shows the
> value of next transaction as 16453, but not much more than
> that. Set that database to be read-only. Copy the first
> 8192 bytes from the read-only database to the beginning
> of a copy of the broken database. Try opening that."
>
> The thing is, I don't work with firebird (yet) and I don't have a clue how
> to start doing this....
>

First, I don't promise this will work. There may be more
corruption further in.

However, your header page has a bad checksum (should be 12345) and
a bad ODS number. Otherwise it looks pretty good. The "pages: 3"
just means that the first pointer page for the RDB$PAGES table is
on page 3, just where it should be.

This is the header page dump.

0 HEADER PAGE checksum 12288 generation 16468
Page size: 4096, version: 0.0(1), pages: 3
Creation date: Aug 2, 2006 11:11:08
Oldest trans 3700, oldest_active 16284, oldest_snapshot 16277,
next trans 16453, bumped trans 1
file sequence # 0, flags 0, attachment 0
implementation 16, shadow count 0

Variable header data:
*END*

Unfortunately, page 1, which should be a page inventory
page is actually a second copy of the header page.

Page 2 is the page inventory page, which looks pretty normal

Page 3 is an unused write-ahead-log page.

Page 4 appears to be the pointer page for RDB$PAGES which should
have been first.

So, having looked again, I revise my suggestion and suggest instead
that you copy all but the first 4096 bytes to a different file, then
copy 4096 bytes from a correct, read-only database on top of the
first 4096 bytes of copy.

To make the "good" database, just create a database and start
transactions in a loop until you get to about 16,500.

Absolutely no guarantees, but it's the best idea I have unless
you can afford professional services, or can attract the
interest of a Firebird developer who has time and inclination
to fix your problem for free.


Good luck,


Ann