Mailtraq - the Complete Email Server

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

KB06071801 Recovering from Database corruption (AFV)

This KB Article refers to the AFV Database

Method 1 - Recovery with access to a valid backup

It is strongly recommended that you have a backup routine so that you have backup to hand should you ever need it.

Mailtraq Professional users should use the online backup system built into Mailtraq.

You can read about creating a backup/restore regime here

Mailtraq Essential and Mailtraq Professional users using the 'manual' backup method
should use the following procedure:

To use a recent backup:

    1. Shut down Mailtraq
    2. Locate the Database folder.
      The Default location is C:\Program Files\Mailtraq\Database but it may be located in a custom location.
    3. Rename the Database folder to Database-old
    4. Copy your backup Database folder into place.
    5. Restart Mailtraq.

Mailtraq will now be running exactly as it was when the last backup was done.

See also: KB06071802 Repairing a corrupted Firebird database  &  KB08040101 Repairing a corrupt AFX 'mailbox'

Method 2 - Recovery without access to a valid backup

It may not be possible to fully recover from a corrupted database without access to a valid backup, however the following procedure will allow you recover as much as possible. You should consider how to prevent new mail from routing whilst you perform the recovery. Mailtraq should be isolated form the mail flow. The method used will differ from installation to installation - could could consider changing the machine name and IP address temporarily, changing the NAT settings on the router, disconnecting from the network or other appropriate methods.

Step 1 - Damage Limitation

As soon as you become aware of corruption:

  1. Use the Tools | Backup Configuration to capture the current Configuration of Users, Mailboxes and Routes.
  2. Shutdown Mailtraq and take a copy of the Database folder. The Default location is C:\Program Files\Mailtraq\Database but it may be located in a custom location.  Save it to a safe place. This will provide you with a reserve data structure.

Step 2 - Create a shadow installation

  1. Obtain a new download of Mailtraq from your account at and install it on another machine on your network: be sure to select the same Database type as your existing installation. This is within the terms of your license.

    If you need to get a download of an old version of Mailtraq to follow the 'shadow' install process you can do so from this location:

  2. Do the minimum to complete the installation procedure - do not use the Installation Wizard
  3. Use the Tools | Backup Configuration to capture the current Configuration of Users, Mailboxes and Routes.
  4. Shutdown Mailtraq.
  5. Locate the Configuration folder you just created. It will be here: C:\Program Files\Mailtraq\database
  6. Copy the Configuration folder you created on the 'old Mailtraq' to the same location.
  7. Restart Mailtraq
  8. Use Tools | Restore Configuration to use the Configuration you imported. The wizard will instruct you to shutdown and restart Mailtraq.

Your new Mailtraq will now be configured with your Users, Mailboxes and Routes but will have no knowledge of any mail stores.

Step 3 - Import Messages

  1. Use the Export Messages tool to export messages from the old Mailtraq - mailbox by mailbox. Read how here ...
  2. Use the Import Messages Wizard to to import those messages into the new Mailtraq.

Step 4 - Restore Mailtraq to the original machine

  1. Shutdown Mailtraq
  2. Copy the entire Database folder from the temporary Mailtraq machine to replace the Database folder on the old machine.
  3. Restart Mailtraq


More information for Firebird users


Mailtraq stores the message routing and configuration separately from the message store. It is therefore possible to abandon a corrupted database and start again.
Shut Mailtraq down, rename the mailtraq.fdb file to mailtraq-old.fdb, and then restart Mailtraq.
Mailtraq will create a new empty database and continue to route messages following the existing configuration.

Extracting messages from a corrupt Firebird database

Problem: You have a mailtraq.fdb database file that holds messages you need to recover, but when you attempt to search you get no results. This indicates corruption, however it is likely that the corruption only affects a small proportion of the FDB file. This method allows you to extract all the recoverable messages from the database and place them in one AFX file for importing into a current version of Mailtraq. You will then be able to search the new AFX file to recover the messages.


Mailtraq must be shut down and you should work on a copy of the mailtraq.fdb file

Locate the folder containing the (copy) mailtraq.fdb


...unpack it all, including its  .dll files, into the same folder.

To get all the messages available into an .afx file, you do this:
at a DOS command prompt from inside that folder enter the following command:
(remember you will need to CD  to get there)

fdbutil -d mailtraq.fdb -df mailtraq.afx

And all available messages in mailtraq.FDB should be put into a new file
called mailtraq.AFX 

You will then need to import from the mailtraq.afx  like this

Keywords: kb troubleshooting
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video


   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.