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
- Stop the MailStore Server service.
- Copy the problematic MailStoreFileGroup.fdb or MailStoreMaster.fdb and associated .key file into the Firebird directory.
- Open an elevated Windows command prompt and navigate into the Firebird sub directory of the MailStore installation folder.
- 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 - Create a backup of the database
gbak.exe -backup_database -verify -ignore -garbage_collect -user SYSDBA MailStoreFileGroup.fdb MailStoreFileGroup.fbk - Create a new database from the backup:
gbak.exe -create_database -replace -user SYSDBA MailStoreFileGroup.fbk MailStoreFileGroup_repaired.fdb - The new database has to be set back to read-write mode
gfix.exe -mode read_write -user SYSDBA MailStoreFileGroup_repaired.fdb - 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.
- Start the MailStore Server service and check whether the databases can be loaded successfully.
MailStore version 9 and earlier
- Stop the MailStore Server service.
- Copy the problematic MailStoreFileGroup.fdb or MailStoreMaster.fdb into the Firebird directory.
- Open an elevated Windows command prompt and navigate into the Firebird sub directory of the MailStore installation folder.
- 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 - Create a backup of the database:
gbak.exe -backup_database -verify -inactive -ignore -garbage_collect -user SYSDBA MailStoreFileGroup.fdb MailStoreFileGroup.fbk - Create a new database from the backup:
gbak.exe -create_database -replace -user SYSDBA MailStoreFileGroup.fbk MailStoreFileGroup_repaired.fdb - The new database has to be set back to read-write mode:
gfix.exe -mode read_write -user SYSDBA MailStoreFileGroup_repaired.fdb - 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.
- Start the MailStore Server service and check whether the databases can be loaded successfully.