Database repair

<< Detect and avoid database errors | Firebird administration using IBExpert | Typical causes of server problems and how to avoid them >>

Database repair


Database repair using GFIX

  SET ISC_USER=SYSDBA
  SET ISC_PASSWORD=masterkey

  Copy employee.gdb database.gdb

Validate database:

 gfix -v -full database.gdb

On error try mend:

 gfix -mend -full -ignore database.gdb

Check again:

 gfix -v -full database.gdb

On error try backup without garbage collection:

 gbak -backup -v -ignore -garbage database.gdb database.gbk

Finally try restore:

 gbak -create -v database.gbk database.gdb

See also:
GBAK
GFIX
Database validation

Alternative database repair methods

Database corruption can occur at any time in any part of the database. The sudden panic that often accompanies such a serious problem can be mitigated by planning for the worst case scenario, before it actually happens: who to call, what to do. Having a plan and executing it. Our proposal: always have a warm backup copy of the database as read-only. Most companies can function with a read-only database for at least a few hours without critically failing the business, giving you time to put your contingency plan into action. Always rely on two databases: the live and the replicated; so with the knowledge that you can switch in an emergency with minimal loss of data.

For more information about replication, please refer to Bidirectional replication for InterBase and Firebird.

Then you will need to begin to analyze your problem, locate it and, as far as possible, repair it.

Begin with GFIX. If that doesn't bring you any further, limit the damage to as few data sets as possible, and use IBExpert's Extract Metadata to extract all healthy data. Please refer to our article: Database repair using Extract Metadata.

See also:
Database corruption
Firebird for the database expert: Episode 3 - On Disk Consistency
Preventing data loss
Database validation
Database properties
How to analyse and repair a corrupted database
Firebird database housekeeping utility
GFIX
GBAK and GSPLIT
Forced writes
Alternative database repair methods
Detect and avoid database errors
Tracking down crashes on Win32 systems
Tracking down crashes on Linux

back to top of page
<< Detect and avoid database errors | Firebird administration using IBExpert | Typical causes of server problems and how to avoid them >>