Subject Database corruption
Author Jonathan Neve
Hi all,

A while back I brought up the subject of database corruption, and I was
basically told that IB makes it theoretically impossible (due to careful
writes) for a database to get corrupted, unless of course it's a matter
of file system copy of the GDB, or something like that.

Anyway, I have again got a DB corruption on a customer's PC, and so I'd
like to figure out what it's due to: is it a bug, or is there something
I can do to avoid it happening?

I'm currently using IB 6.0.1.0, on Win 98.

The DB first started showing signs of curruption this morning at 9:00.
According to the little information I could gather from my customer,
"nothing happened"... (as always ;-) ). The only interesting bit of
information I can gather (from interbase.log) is that at 7:20 this
morning, the PC was turned on, and the following error occured:

DULU-ECO (Client) Wed Jan 26 07:21:01 2005
INET/inet_error: read errno = 10054

Several other identical errors occured also on Monday.

The machine was then shutdown (abnormally I presume, because there's no
trace of any clean shutdown in the log), and restarted (as evidenced by
the fact that at 9:00, the gardian was restarted):

DULU-ECO (Client) Wed Jan 26 09:00:07 2005
Guardian starting: C:\Program Files\Borland\InterBase\bin\ibserver.exe

From that point on, the database was corrupted:

DULU-ECO (Server) Wed Jan 26 09:02:30 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
internal gds software consistency check (cannot find record fragment
(248))

So then I tried a DB validation using IBConsole, and I got:

Record level : 5
Index page level : 2
Database page level : over 12000

and in the log:

DULU-ECO (Server) Wed Jan 26 14:27:22 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Relation has 15 orphan backversions (0 in use) in table TRAVAIL (134)


DULU-ECO (Server) Wed Jan 26 14:28:23 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Relation has 1 orphan backversions (34 in use) in table STOCK (138)


DULU-ECO (Server) Wed Jan 26 14:29:03 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Fragmented record 105562 is corrupt in table DOSSIERS (145)


DULU-ECO (Server) Wed Jan 26 14:31:22 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Relation has 1 orphan backversions (0 in use) in table CMD_CLIENT (148)


DULU-ECO (Server) Wed Jan 26 14:31:34 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Relation has 1 orphan backversions (47 in use) in table CLIENTS (150)


DULU-ECO (Server) Wed Jan 26 14:32:09 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Index 1 is corrupt on page 30766 in table RPL$LOG (165)


DULU-ECO (Server) Wed Jan 26 14:32:09 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Index 1 is corrupt on page 30766 in table RPL$LOG (165)

Followed by :

DULU-ECO (Server) Wed Jan 26 14:32:21 2005
Database: C:\MICROTEC\DULUARD\DATA\DULUARD.GDB
Page 8499 is an orphan

and a rather considerable orphanage of other pages suffering from the
same plight...

After that, I attempted to repair the db (still using IBConsole), and
then validated again, producing the following results:

Summary of validation errors

Number of record level errors : 6
Number of index page errors : 2
Number of database page errors : 12946

Check the InterBase.Log file for additional information

So I gather that it's not repairable...

I'm keeping the DB for posterity :-) and I'd be very glad if someone
could shed some light on the (possible) causes of this corruption, and
what I could do in future to prevent it.

Thanks a lot!
Jonathan Neve.