Addressing problems with the SecurityGateway database

Expand / Collapse
 

Addressing problems with the SecurityGateway database


HOWTO: Addressing problems with the SecurityGateway database

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-N TECHNOLOGIES\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 a MSDOS prompt on the SecurityGateway machine...

1. net stop securitygateway <press enter>

If it doesn't shutdown cleanly in Task Manager end these processes...
clamd.exe
SecurityGateway.exe
SGSpamD.exe

2. cd C:\Program Files\Alt-N Technologies\SecurityGateway\App <press enter> (the installation directory may vary on your installation)

3. sgdbtool backup sgdb.bak <press enter> (this will potentially take a long time on a large database)

4. rename SECURITYGATEWAY.FBD SECURITYGATEWAY.OLD <press enter>

5. sgdbtool restore sgdb.bak <press enter> (again this will take a while on a large backup file)

6. net start securitygateway <press enter>

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. net stop securitygateway <press enter>

2. cd C:\Program Files\Alt-N Technologies\SecurityGateway\App <press enter>

3. gfix -validate -user sysdba -password masterkey SECURITYGATEWAY.FBD <press enter>

(this step validates the integrity of the database - this will take a long time if the database file is very large)

4. gfix -mend -user sysdba -password masterkey SECURITYGATEWAY.FBD <press enter>

(this step attempts to fix the corruption in the database - this will take a long time if the database file is very large)

5. net start securitygateway <press enter>

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.