Subject Error: Duplicated item in allocation table detected
Author Juan Pedro López
Hello.

Currently I am testing some applications with Firebird 2.0.3 superserver
for 64 bits linux.

Database is located in a different machine than applications.

I have an automatic backup policy (cron task) consisting of:

- Every night a full nbackup is done. This backup is tested with a gbak
backup and restore to test it is valid.
- Every hour an incremetal nbackup is done.

Right now database is accessed just a few times per day because I am
testing another unrelated issues, but the automatic backup tasks are
continously been executed.

This morning one of the incremental backups failed. I got this message
while executing nbackup:

internal gds software consistency check (Duplicated item in allocation
table detected)
Failure: Database error
[
PROBLEM ON "attach database".
SQLCODE:-902
]

The same error is shown in firebird.log at the same time:

Database: /var/lib/firebird/data/test.fdb
internal gds software consistency check (Duplicated item in allocation
table detected)

When the error happened, no application was accesing the database at
all.

After stopping the firebird server and making a filesystem copy of the
database, I tried to run a "gfix -v" but the same error was shown:

internal gds software consistency check (Duplicated item in allocation
table detected)

Every command I try to run in this database throws the same error.

I have checked that the last pair full nbackup + incremental nbackup can
be restored. I also executed a gfix -v and a gbak backup + restore and
everything is correct in that database.

What could have happened to the database and how could I try to recover
it?

This database has no real data, it is just a matter of knowing what the
problem is and how to solve this problem in case it happens with a
production database.

Thank you very much,

Juan Pedro López