Subject Re: [firebird-support] RE: Advice on storing large numbers of documents in a Firebird database
Author Ann Harrison
On Sun, Nov 17, 2013 at 11:06 AM, marcus <marcus@...> wrote:

>
> However out of interest, would it be possible to do something like a
> gfix verification and possibly sweep after copying to check the
> integrity of the copied file or is this just as slow?
nearly as slow as a regular backup, as gfix uses the same internal
mechanisms as gbak. Ann or Helen has written about that here in the
list, or may be i've read it in the Firebird book.

Gfix and Gbak each read the whole database, so they each take longer
as the database gets larger - otherwise they're opposites.  

Gfix validates the physical structure of the database, making sure that 
every page is either in use or listed as free and that no pages are declared 
as used for one purpose and actually used for another.  At the record level, 
it checks that back version, fragment, and blob pointers point to back
versions, fragments, and blobs.   Gfix also validates the structure of indexes.

Gbak makes a copy of the metadata and data in the database on backup
and recreates the database on restore.  It does not use indexes on data,
so it won't detect a broken index.  A gbak restore will uncover logical errors
like duplicates on primary keys, broken foreign key constraints and other
violations of logical consistency.

If I cared about my data, I'd run gbak regularly to produce backups.  I'd run
gfix -validate from time to time looking for structural errors.  I wouldn't be
too fussy about it - the odd orphaned page or back version is just lost space
and is the expected result of a crash shutdown.  People have stopped
tripping over power cords by now, and operating systems don't crash the
way they did in the bad old days, but you still might find an orphan here
or there.  Finally, I'd restore the backup occasionally to find logical 
errors.

Good luck,

Ann
to