How to recover from a corrupt archive store by merging stores

When an archive store is damaged (typically due to power issues or third party antivirus interaction), the following steps can be used to extract the messages from the problematic archive and merge them into a new archive store.

Check Infrastructure for damage

Before we merge the archive store data we must confirm if the disk the store is using has any disk errors. This is often the reason for why the .dat files have been corrupted in the first place.

We recommend you run a disk check command on the drive as well as check for any possible Antivirus software that may have quarantined the .dat files.

Check for Database damage

If you suspect the Firebird Database could be damaged you can run the following from Administrative tools -> Miscellaneous -> Management shell command:

 RecoverStore –id=x    (where x is the id number of the impacted Store)

This can take a long time to rebuild the database from recovery records.

Merge the old store data with a new store to remove any dead references

Note: We strongly recommend you take a full backup of all your data before taking the steps below.

  1. Stop all current archive jobs from running via the Archive Email link in the MailStore Client.
  2. In Administrative Tools -> Storage -> Storage Locations, use the Create… button to define a new Archive Store with a similar name to the corrupt store (for example 2018-10-new).
  3. In Administrative tools -> Storage -> Storage Locations, determine the ID of both the old damaged store and newly created store via the ID column.
  4. Using the command below, merge the contents of the old store ID into the new store ID. For example, if the old store has ID of 10 and the new store has ID of 11, run the following command via Administrative tools -> Management API -> Command Prompt

    MergeStore -id=11 -sourceId=10

    (Please note this command is case sensitive note the uppercase ‘I’ in ‘sourceId’)

    Please note this can take a very long time to copy the data from one store message by message to the new store as the damage to the existing store may be severe.
  5.  Once completed you will have two stores in Administrative Tools -> Storage -> Storage Locations. You can now detach the old problematic store and delete it from the disk if needed.
  6. Re-enable the archive jobs.