Subject RE: [firebird-support] script to recreate database
Author Puigsegur, Jordi

I know free space is not a problem, but the space that the database is
occupying might be used for other databases ... We keep all our
transactions very short, so the oldest transaction and new transaction
are always very close. We do not have a problem of space, we just want
to reduce the size of the database file when it is not needed.

Secondly, I forgot to tell you that the database contains cache
information, so there is no problem to loose the updates made during the
process. This database is just a repositoire of OTP information that
needs to be calculated.



[] On Behalf Of Mercea Paul
Sent: Friday, July 06, 2007 4:43 PM
Subject: RE: [firebird-support] script to recreate database

Hi Jordi

First , free space is not a reused , probably you have

You miss one very important think about back-up restore process. It's
preserving existing data , eliminate possible errors and garbage
collection(if you want), and other operations what are possible only
back-up restore process(page size).

In that time you make the back-up and restore, all new records will be
after deleting 'old' database. After restoring database you should
active database, import all new records from active database to restored
database and then rename/delete old database .

Free space is reused on new insertion, not necessary to make back-up and
restore for eliminating this space. Look at statistic for Oldest
and Oldest active.what numbers you have?

Best regards,


<> ] On Behalf Of Puigsegur,
Sent: Friday, July 06, 2007 5:27 PM
Subject: [firebird-support] script to recreate database

Hi all,

We have a database that under certain circumstances has a lot of free
space due to massive deletions and we would like to be able to recreate
it using gbak so that it occupies less space.

Does anyone have a script (FB 2.0 / Windows 2003 Server) that does the

1) create a backup of the database using gbak
2) restore the backup using gbak on using a new filename (the current
database stays online)
3) shutdown the online database
4) delete old database file
5) rename new database file to correct database filename
6) put the new database online

The idea would be to minimize the downtime. Since the database is big
(two or three Gigs minimum) we cannot replace the database while doing
the restore with the gbak.


[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]