Subject Re: Database corruption if server is not properly shutdown
Author Adam
--- In, Federico Tello Gentile
<fgentile@s...> wrote:
> I'm developing a web application and I'm starting FB manually.
> I restart my workstation (Linux) but I forget to shutdown the FB
> service. Is this the reason why my DB has been currupted 2 times in
a week?

I doubt it. Unless you have turned off forced writes in which case it
is your own fault. Real corruption on that sort of frequency is more
likely to be a hardware related.

> By corrupted I mean bogus erros when doing perfectly ok queries, and
> alowing me to violate referentail integrity. Recreating all the
> from scratch (dropping and re creating) did not fix anything so I
had to
> create a new database with the same name.

Bogus errors could mean you have an incorrect message file, but if you
want assistance with diagnosing these errors you will need to be
specific with versions etc.

How did you "drop and re create" the database? What sort of
"referential integrity" was broken, ie a declared constraint such as a
foreign key, or was it some action that a trigger you wrote is meant
to prevent?

> I think the FB server gets the termination signal from the OS when
> shuting down the system, but I guess it does not shut itself down.

It is always nicest to tell the server to close. It can then leave the
database in a "less garbagy" state if it finishes its operation. But I
have never come across data corruption because someone has reboot
their computer with the 3 finger salute or even just hitting the power
or reset button. Firebird doesn't have any transaction log it needs to
rollback if it is shut down in a not so nice manner. It is possible
that some orphan records are left in place, but they will be flagged
as garbage by the first transaction that discovers it.

IBPhoenix contains a lot of information about on disk consistency and
how it exactly works, but Firebird is ACID compliant, which basically
means with the exception of hard drive failure, it should survive any
other nasty you throw its way.