Subject RE: [firebird-support] script to recreate database
Author Mercea Paul
Hi Jordi



First , free space is not a problem.is reused , probably you have garbage
collection.



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

In that time you make the back-up and restore, all new records will be lost
after deleting 'old' database. After restoring database you should shutdown
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 transaction
and Oldest active.what numbers you have?



Best regards,

Paul





From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Puigsegur, Jordi
Sent: Friday, July 06, 2007 5:27 PM
To: firebird-support@yahoogroups.com
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
following:

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.

Jordi.





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