Subject Re: [firebird-support] Compacting Firebird Database
Author Helen Borrie
At 11:31 AM 4/10/2009, you wrote:
>Good morning,
>
>I need to know how to COMPACT a firebird database.

You don't "compact" a firebird database. Disk space is allocated from the file system. Space from obsolete record versions is re-used eventually, when garbage collection frees it up.

If you want to make a "fresh start" with disk space usage in your database, you can make a gbak backup, then restore it use the -create_database option, test the new database is OK, and use it to replace the old database.

>Also, is this "functionality" works if I user multi-file firebird database?

Yes. You can get all the instructions for doing gbak backups and restores, including details about backing up and restoring multi-file databases, from the IB6 Beta docs Operations Guide (opguide.pdf, links available in the Documentation Index at the Firebird website).

Be aware that the restored database will contain the data that were visible to gbak's transaction when the backup was started. Therefore, if it is your intention to "start afresh" by this method, you should do both operations in immediate succession, during a period when no user data is being modified.

This kind of housekeeping is not needed frequently if your applications are managing transactions properly. Garbage collection is a continuing process that occurs in several ways. A gbak -backup can be run at any time, including when you have users logged in, and it will look after any garbage that needs collecting.

./heLen