Subject Re: Detect Database corruption reasons?
Author Adam
--- In firebird-support@yahoogroups.com, "Mustafa ÂȘimÂșek"
<mussimsek@...> wrote:
>
> Hi,
>
> i use Firebird 1.5.3 and i am happy.

1.5.4 is the latest stable release in 1.5.

>
> i deploy my programs a lot of customers and different locations. i
recommend
> using UPS for electric problems and they use too. But sometimes
there are
> some electrical problems and windows crashed and database corrupted. But
> sometimes db corrupted when electric ok. i usually see "*internal gds
> software consistency check ... *" error.

Crashed servers should never take the database down with them (in
theory of course, in the real world anything is possible). Does your
database have forced writes (synchronous writes) enabled?

>
> i have some questions and i want advise.
>
> 1. i use Remote Desktop connection for some administrative tools. XP
has 2
> connection limits for RDC. This server has 3 clients. i see in
firebird log
> "*Shutting down the Firebird service with 2 active connection(s) to 1
> database(s) *" error. and in NT event log these errors :
>
> *"The Firebird Server - DefaultInstance service was successfully
sent a Stop
> control.
>
> For more information, see Help and Support Center at
> http://go.microsoft.com/fwlink/events.asp.",
>
> "The description for Event ID ( 261 ) in Source (
> FirebirdGuardianDefaultInstance ) cannot be found. The local
computer may
> not have the necessary registry information or message DLL files to
display
> messages from a remote computer. You may be able to use the
/AUXSOURCE= flag
> to retrieve this description; see Help and Support for details. The
> following information is part of the event: Server Shutdown: C:\Program
> Files\Firebird\Firebird_1_5\bin\fbserver.exe: normal shutdown 384
> 402653184 s and supply the2"*
>
> Remote Desktop Connection could cause any corruption or close
service for
> database?

No.

>
> 2. i see sometimes in firebird.log deadlock error. is this cause any
> corruption for database. error like this : "lock conflict on no wait
> transaction
> deadlock ..."

Are you sure there was a lock conflict in firebird.log? That exception
is basically two transactions attempting to modify the same record at
the same time. It is an 'expected exception' in any multi user
environment, certainly nothing I would expect to see Firebird logging.
I just checked one of our production servers, and a lock conflict has
not been logged in the Firebird log (which was cleared some time in
Jan 2007).

>
> 3. i use Delphi 6. Some project use IBX components and one project
use BDE
> for connection firebird. anything related with this?

IBX should be fine (not the best choice, but works). BDE is absolutely
terrible, but I am not aware of it causing corruption (certainly
causes performance problems).

>
> 4. i use generally Firebird 1.5.3. Update 1.5.4 could help with this?

Uninstall 1.5.3. Run 1.5.4 installer. That simple. You may want to
take a copy of your firebird.conf and aliases.conf (although IIRC, the
uninstaller leaves these in tact.

>
> 5. Clients use generally Windows XP SP2. i close system restore future.
> anything related XP or antivirus could cause corruption?

Clients should not cause corruption in server. The server should
either avoid the gdb file extension for your database, or switch of
system restore on the volume the database is running.

>
> 6. while Firebird Service open Copying database file (Windows
copy-paste)
> could cause corruptions? i warn my customer didn't do with live copy
when
> service open but maybe they do this sometimes.

Definitely causes corruption in the 'pasted' database. Some report
seeing corruption in the source as well. In short, never do this. In
fact, don't let the user or virus scanner or backup tool 'touch' the
database file while Firebird is running. You may need to assist the
customer by providing instructions for using gbak or pointing out one
of the many tools that can safely backup Firebird databases.

>
> 7. Some of my foreign keys is rarely used. For example if there is about
> 60.000 records only 70 or 80 records has a value, the others is
null. i read
> this type foreign keys isn't recommended. This type database design
faults
> could cause corruptions?

No, but will certainly cause performance problems under some
situations. You are better off creating a separate table to store
these sorts of information.

>
> These happen very rare but a lot of time waste for me. it tooks nearly a
> work day for me and i couldn't detect reasons. How could i detect exact
> reasons for corruptions?

We have about 70 databases on our hosted servers ranging from small
5-10 user through to several hundred user databases. In the past 3
years, I have seen just one corruption on a database on these servers,
and that is directly traceable to someone backing up the database file
that was in use.

I think the problem in your case is that you can not guarantee that
the files are handled in a safe manner. You may need to use file
system permissions to explicitly deny the users from accessing the
database file. Also make sure to configure the backup and virus
scanner applications on the server to avoid touching the database
file. Of course faulty hardware should be considered too.

Adam