Note: The Firebird database is retained for backwards compatibility but is no longer supported.
Unless you have expertise in direct management of Firebird we recommend migrating to the AFX database.
The Firebird edition of Mailtraq uses a proprietary SQL database called Firebird.
Mail messages are stored in a single file called mailtraq.fdb , which is found in the Database folder of the Mailtraq
installation.
How does corruption happen?
The Mailtraq Firebird database is robust and seldom has problems, but corruption can occur:
- due to lack of space, or
- by attempting to backup the mailtraq.fdb file without shutting down Mailtraq
(see www.mailtraq.com/backup for the correct backup methods), or - abruptly shutting down the computer or unscheduled power-offs.
The simplest solution to a corruption event is to restore the Database from your latest backup. See www.mailtraq.com/backup
If you do not have a usable backup then you can attempt to restore the recoverable portion of the database files.
This is a step-by-step method for correcting recoverable database files.
It requires that you have available a full copy of Firebird. Mailtraq normally only uses a limited edition. Installing the full version of Firebird provides a suite of 'utilities' - this KB article refers to GBAK and GFIX the back-up and mending 'utilities'.
Download and install a copy of Firebird from www.firebirdsql.org
This example used Firebird_2_0 You should use the current version.
Install in SuperServer mode to default location: C:\Program Files\Firebird\Firebird_2_n
Set not to run everytime windows starts.
Accept the rest of the default settings.
Run Firebird.
The default location of the Mailtraq Firebird DataBase (FDB) file is:
C:\Program Files\Mailtraq\database\mailtraq.fdb
This KB article refers to the default locations - if you have installed to different locations you will need to adjust accordingly. All actions take place at the Windows Command Prompt. Note that all the Firebird commands entered at the Command Prompt are on one line
Method A.
Backup and Restore
This procedure, using Firebird GBAK, usually solves most problems. The actions of backing up and restoring smooth out winkles in the file and allow it to be accessed normally.
Restore processes can take a lot of disk space, so be sure to have at least three times as much free space on your hard drive as the size of the mailtraq.fdb file you are working with (see Tips below).
Always work with Mailtraq shut down, and on a copy of the mailtraq.fdb file. NEVER work on a live Mailtraq or on the only copy of the mailtraq.fdb file.
Step 1.
Shut down Mailtraq.
Rename C:\Program Files\Mailtraq\database\mailtraq.fdb to old.fdb
Make a copy of C:\Program Files\Mailtraq\database\old.fdb and call it copy.fdb
Open a Windows Command Prompt and enter the following command on one line, to back it up - run:
"C:\Program Files\Firebird\Firebird_2_0\bin\gbak.exe" -b -v -user sysdba -pass masterkey "c:\Program Files\Mailtraq\database\copy.FDB" c:\temp\copy.fbk
Step 2.
Restore the file. At the Windows Command Prompt and enter the following command on one line:
"C:\Program Files\Firebird\Firebird_2_0\bin\gbak.exe" -c -v -user sysdba -pass masterkey "c:\temp\copy.fbk" "c:\program files\Mailtraq\database\copy.FDB"
Step 3.
Confirm that the file C:\Program Files\Mailtraq\database\copy.fdb has been created
Rename the file called C:\Program Files\Mailtraq\database\copy.fdb to mailtraq.fdb
Delete the file called C:\Program Files\Mailtraq\database\old.fdb
Step 4.
Restart Mailtraq - and confirm that the evidence of corruption has been removed.
Method B
If the simple backup-and-restore method described above does not resolve the problem you can use Firebird GFIX to check and fix the database.
Step 1.
Shut down Mailtraq.
Rename C:\Program Files\Mailtraq\database\mailtraq.fdb to old.fdb
Make a copy of C:\Program Files\Mailtraq\database\old.fdb and call it copy.fdb
Step2.
Open a Windows Command Prompt and enter the following command on one line, to check for corruption:
"C:\Program Files\Firebird\Firebird_2_0\bin\gfix.exe" -v -full -user sysdba -pass masterkey "c:\Program Files\Mailtraq\database\copy.FDB"
Firebird will respond with any corruption errors.
Step 3.
Then run this to mend it: enter the following command on one line, to fix it:
"C:\Program Files\Firebird\Firebird_2_0\bin\gfix.exe" -mend -full -ignore -user sysdba -pass masterkey "c:\Program Files\Mailtraq\database\copy.FDB"
Step 4.
Now check to see if the corruption has been repaired: enter the following command on one line:
"C:\Program Files\Firebird\Firebird_2_0\bin\gfix.exe" -v -full -user sysdba -pass masterkey "c:\Program Files\Mailtraq\database\copy.FDB"
Step 5:
If all seems well, then go to Step 7.
If you still see errors: Back up like this: enter the following command on one line:
"C:\Program Files\Firebird\Firebird_2_0\bin\gbak.exe" -b -v -ignore -user sysdba -pass masterkey "c:\Program
Files\Mailtraq\database\copy.FDB" c:\temp\copy.fbk
Step 6.
And then restore like this: enter the following command on one line:
"C:\Program Files\Firebird\Firebird_2_0\bin\gbak.exe" -c -v -user sysdba -pass masterkey "c:\temp\copy.fbk" "c:\program files\Mailtraq\database\copy.FDB"
Step 7.
Shutdown the Firebird server (in the system tray)
Step8.
Confirm that the file C:\Program Files\Mailtraq\database\copy.fdb has been created
Rename the file called C:\Program Files\Mailtraq\database\copy.fdb to mailtraq.fdb
Delete the file called C:\Program Files\Mailtraq\database\old.fdb
Restart Mailtraq
Extract All - Alternate procedure
If you are unable to recover the messages from the mailtraq.fdb file using the above procedures it may still be possible to extract them to the current Mailtraq database format - AFX - and then import those messages.
Method
Locate the folder containing the *copy* mailtraq.fdb
Download http://resources.mailtraq.com/files/fdbutil.zip
and 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 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 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 www.mailtraq.com/import
Configuration Tips
If you do not have enough space, then - with Mailtraq shut down - copy the mailtraq.fdb file to a machine that does have enough space and procede from there. You will need to create a matching folder structure, or adjust the commands detailed above accordingly.