Subject Re: [firebird-support] RE: Advice on storing large numbers of documents in a Firebird database
Author Mike Ro
On 17/11/2013 19:23, Ann Harrison wrote:
 
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.


Ann, thank you very much for this insightful information. The clear message that I take away is that it is important to use *both* gbak and gfix, either one on their own won't give the best protection.

Many thanks.........Mick.