Articles

How to repair a corrupt Firebird database?

Alexey Kovyazin, last update 28-March-2014
If Firebird database is corrupted, please follow these steps to fix it:

  1. Stop Firebird server. Don't use corrupted database - it leads to further corruption. Also, do not copy Firebird database when Firebird server is running - it leads to corrupted copy and, sometimes, to the corrupted original database.
  2. Make a copy of Firebird database. Always keep an original copy of corrupted Firebird database for possible future use.
  3. Start Firebird server and run the following commands:
    gfix.exe -v -full -user SYSDBA -pass masterkey path_to_your_database
    gfix.exe -mend -user SYSDBA -pass masterkey path_to_your_database
    gbak -b -v -user SYSDBA -pass masterkey path_to_your_database path_to_backup


    Try to run them all, even if gfix shows errors.
     
  4. If backup completed successfully, restore database:
    gbak -c -v -user SYSDBA -pass masterkey path_to_backup path_to_database
     
  5. If gbak fails, download FirstAID Diagnostician, install it and run Diagnose on original corrupted database. See more details at FirstAID product page. Send full error text (or screenshot) and diagnostics log to IBSurgeon Support [email protected].

IBSurgeon's recovery tools

We offer FirstAID tools for automated database recovery, which (in combination with standard gfix and gbak) allow to fix up to 95% of the most prevalent Firebird and InterBase database corruptions.
If a full version of FirstAID will be unable to fix database corruption, we offer 2 hours of free recovery support to resolve this issue. 
For more information contact IBSurgeon's support: [email protected].

 

Subscribe to IBSurgeon news

Subscribe