The default database sweep value is 20000. If this value has been amended to Zero, it will be necessary to empty out accumulated 'garbage'. This can be achieved by either performing a Firebird Validate / Backup and Restore of the database, or manually initiating a sweep. In the case of manually initiating a sweep it should be noted, that, despite the garbage being maintained, you should still be conducting a 'regular' Firebird Backup and Restore to maintain table indexes, database error checking and re-compacting the database size.
A manual sweep does not require exclusive database access. however this should only be conducted when the database is 'quiet', eg: overnight when the database is not being fully utilised.
Determining the Current Garbage Size (optional):
To determine the current garbage size run the gstat -h command from a Command Prompt. Substitute the Firebird 'bin' folder path appropriate to its location on your server along with database path and name as necessary
eg:
cd C:\Program Files\Firebird\Firebird_2_5\binSET ISC_USER=SYSDBA
SET ISC_PASSWORD=masterkey
gstat -h "H:\Ostendo\Ostendo DB\Demo.fdb"
This will produce various statistics for for this database. The difference between the Oldest Transaction and the Oldest Active Transaction will give you the approx garbage size being stored in the database.
Running a Manual Sweep:
From the Command Prompt run the gfix -sweep command against the database. Substitute the Firebird 'bin' folder path appropriate to its location on your server along with database path and name as necessary
eg:
cd C:\Program Files\Firebird\Firebird_2_5\bin
SET ISC_USER=SYSDBA
SET ISC_PASSWORD=masterkey
gfix -sweep "H:\Ostendo\Ostendo DB\Demo.fdb"
Automating The Manual Sweep Process:
The above DOS Commands relating to a manual sweep can be included in a Batch File which could be scheduled to run via Windows Task Scheduler on a nightly basis