Rebuilding Damaged MailStore Database using gfix.exe tool

In some cases, it is possible  to recover a MailStore Database file that has damage using the built-in Firebird database backup and recovery tool gfix.exe

The location of the gfix.exe tool varies based on the version of MailStore:

MailStore version 10 and later

Firebird directory locations are: 

64bit Operating System: C:\Program Files (x86)\deepinvent\MailStore Server\Firebird3_x64

32bit Operating System: C:\Program Files (x86)\deepinvent\MailStore Server\Firebird3_x86

  1. Stop the MailStore Server service.
  2. Copy the problematic MailStoreFileGroup.fdb or MailStoreMaster.fdb and associated .key file into the Firebird directory.
  3. Open an elevated Windows command prompt and navigate into the Firebird sub directory of the MailStore installation folder.
  4. The database has to be set into read-only mode (in the below examples we are acting on a MailStoreFileGroup.fdb):
    gfix.exe -mode read_only -user SYSDBA -password masterkey MailStoreFileGroup.fdb
  5. Create a backup of the database
    gbak.exe -backup_database -verify -ignore -garbage_collect -user SYSDBA MailStoreFileGroup.fdb MailStoreFileGroup.fbk
  6. Create a new database from the backup:
    gbak.exe -create_database -replace -user SYSDBA MailStoreFileGroup.fbk MailStoreFileGroup_repaired.fdb
  7. The new database has to be set back to read-write mode
    gfix.exe -mode read_write -user SYSDBA MailStoreFileGroup_repaired.fdb
  8. Copy the MailStoreFileGroup_repaired.fdb back to \MailArchive\DefaultFileGroup folder, rename the existing database file so it is not used and rename the new repaired file by removing _repaired from the filename.
  9. Start the MailStore Server service and check whether the databases can be loaded successfully.

MailStore version 9 and earlier

  1. Stop the MailStore Server service.
  2. Copy the problematic MailStoreFileGroup.fdb or MailStoreMaster.fdb into the Firebird directory.
  3. Open an elevated Windows command prompt and navigate into the Firebird sub directory of the MailStore installation folder.
  4. The database has to be set into read-only mode (in the below examples we are acting on a MailStoreFileGroup.fdb):
    gfix.exe -mode read_only -user SYSDBA -password masterkey MailStoreFileGroup.fdb
  5. Create a backup of the database:
    gbak.exe -backup_database -verify -inactive -ignore -garbage_collect -user SYSDBA MailStoreFileGroup.fdb MailStoreFileGroup.fbk
  6. Create a new database from the backup:
    gbak.exe -create_database -replace -user SYSDBA MailStoreFileGroup.fbk MailStoreFileGroup_repaired.fdb
  7. The new database has to be set back to read-write mode:
    gfix.exe -mode read_write -user SYSDBA MailStoreFileGroup_repaired.fdb
  8. Copy the MailStoreFileGroup_repaired.fdb back to \MailArchive\DefaultFileGroup folder, rename the existing database file so it is not used and rename the new repaired file by removing _repaired from the filename.
  9. Start the MailStore Server service and check whether the databases can be loaded successfully.
Copy link
Powered by Social Snap