SecurityGateway uses a Firebird database and this database type is not prone to corruption, but there are circumstances where it will envitably encounter problems such as where there is direct interaction by 3rd Party software (eg. 3rd party antivirus software) or where the machine it is installed on is hard shutdown due to power failure.
Typically this will result in problems accessing the SecurityGateway interface; starting the SecurityGateway service; getting continual “SMTP Server Too Busy errors” when attempting to send mail through it; mail stuck in “Queued for Delivery” and not being processed or specific errors in SecurityGateway’s system log file like this –
database file appears corrupt “(C:\PROGRAM FILES\ALT-NTECHNOLOGIES\SECURITYGATEWAY\APP\SECURITYGATEWAY.FBD)” or “*** IBPP::SQLException ***” or “Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements”.
Taking the steps below will help rebuild the database with all existing configuration, queued mail, etc intact:
From an elevated command prompt on the SecurityGateway machine…
- stop the servcie with net stop securitygateway
If it doesn’t shutdown cleanly in Task Manager end these processes…
clamd.exe
SecurityGateway.exe
SGSpamD.exe - Navigate to the correct directory with cd C:\Program Files\Alt-N Technologies\SecurityGateway\App <press enter> (the installation directory may vary on your installation)
- run the command sgdbtool backup sgdb.bak (this will potentially take a long time on a large database)
- rename SECURITYGATEWAY.FBD to SECURITYGATEWAY.OLD <press enter>
- run the command sgdbtool restore sgdb.bak (again this will take a while on a large backup file)
- start the service with net start securitygateway
At this point you should be able to login to the SecurityGateway interface and email should be flowing normally.
Once you are happy all is well you can delete the SECURITYGATEWAY.OLD and sgdb.bak file from the C:\Program Files\Alt-N Technologies\SecurityGateway\App folder.
If it’s not possible to perform an initial backup of the SECURITYGATEWAY.FBD file and running a sgdbtool backup sgdb.bak produces errors then the next stage is to try and repair the corruption in the existing database as follows…
From a MSDOS prompt on the SecurityGateway machine…
1. Stop the servcie with net stop securitygateway
2. Navigate to the correct directory with cd C:\Program Files\Alt-N Technologies\SecurityGateway\App
3. run the command gfix -validate -user sysdba -password masterkey SECURITYGATEWAY.FBD
(this step validates the integrity of the database – this will take a long time if the database file is very large)
4. run the command gfix -mend -user sysdba -password masterkey SECURITYGATEWAY.FBD
(this step attempts to fix the corruption in the database – this will take a long time if the database file is very large)
5.Start the service with net start securitygateway
If despite taking the steps above SecurityGateway still won’t start or process email then the database is not recoverable and it will be necessary to either restore a backup copy of SecurityGateway or remove the installation and reinstall it, then manually reconfigure it.