Subject Re: [firebird-support] Corrupted database
Author Ann W. Harrison
Evelyne,


Check on IBPhoenix.com, it has general instructions for recovering
a corrupted database.

One page of a large blob was not written and is still filled with 0's -
I don't know why.

Make a copy of the broken database.

Run another backup to determine which table has the broken blob,
using the -v switch.

Determine which record has the broken blob. Using ISQL:

step 1)
select <primary key> from <table>
where <blob field> not containing 'a' or
<blob field> containing 'a'
order by <primary key>

note the last value printed. Then
step 2)
select first 1 <primary key> from <table>
where <primary key> > <last good record PK>

Then
step 3)
select <primary key> from <table>
where (<blob field> not containing 'a' or
<blob field> containing 'a') and
<primary key> <> <bad record primary key>

If that last command runs to success, you've got only
one bad record. If not, repeat steps 1-3 until you've got
a complete list of the bad record.

Create a new table identical to the table with the bad
blob. Copy the good records of the old table into the
new table. Copy the non-blob data from the bad record(s)
to the new table. Drop the old table. Recreate the
old table. Pump all the data back to the old table.


Regards,


Ann