Subject Please help: Corrupted DB, unable to backup
Author Thomas Woinke
Hi there,

looks like I'm in trouble here.

I can't backup the database anymore, due to a corrupted table.
gbak stops at the table RATING_STATS with the message
internal gds software consistency check (invalid SEND request (167),
file: exe.cpp line: 643)
when trying to backup.

The table looks like this:

ALBUM_ID BIGINT Nullable
REVIEW_ID BIGINT Nullable
CONCERT_ID INTEGER Nullable
INTERVIEW_ID INTEGER Nullable
ARTICLE_ID INTEGER Nullable
NEWS_ID INTEGER Nullable
TOTAL_RATE NUMERIC(3, 2) Not Null DEFAULT 0
TOTAL_VOTES NUMERIC(3, 2) Not Null DEFAULT 0
INSERTED TIMESTAMP Not Null DEFAULT CURRENT_TIMESTAMP
UPDATED TIMESTAMP Nullable

I already removed any foreign keys.

Doing select * from rating_stats takes a few seconds, then results in
an empty set.After exiting isql i get this:
Statement failed, SQLCODE = -902
internal gds software consistency check (can't continue after bugcheck)
Statement failed, SQLCODE = -902
internal gds software consistency check (can't continue after bugcheck)


Here is what happened

I got the message
internal gds software consistency check (Internal error code (167),
file: exe.cpp line: 643)
when doing an insert on this table.

Expecting corruption, i did
gfix -validate on the database. It did not output anything.

I stopped the firebird server, copied the file, and did a
gfix -mend on the copy
Which reported 91 corruptions.
Rerunning does not output anything.

Trying to do a backup from the copy does not work either, with the same error.

Trying to drop the table does not work, too. I am getting
SQL> drop table rating_stats;
Statement failed, SQLCODE = -607
unsuccessful metadata update
-cannot delete
-COLUMN REVIEW_ID
-there are 1 dependencies

What could that be? I dropped everything else that had to to with this
table, including any foreign keys.
Database Workbench does not show any further dependencies.

I'm really out of ideas now.
My plan is to get the database into a state where I can make a backup
again, and then restore it from there.
But I have to get rid of that table in order to do so.

I'm using Firebird 2.1.1 SuperServer on Linux AMD64, Forced Writes are on.

Thank you in advance.

/thomas