Subject RE: [firebird-support] gbak
Author Alan McDonald
> Hello, is it safe to run this bat with the Firebird (2.1) service
> running ?
> What if there is a user attached to the database?
> If this is not the correct way to do it, which is the correct one?
> Thanks!!
> Sergio
> ------- RESTORE.BAT --------
> del log.txt
> gbak data.fdb datos.fbk -user sysdba -password
> masterkey -ignore -Limbo -v -y log.txt
> gbak -create -v data.fbk data_rec.fdb -user sysdba -password
> masterkey -n -r -p 4096
> ren data.fdb data_old.fdb
> ren data_rec.fdb data.fdb
> --------------------------

Backing up is a frequent operation. Restoring is also frequent if the
operation is done to test a valid backup and ensure restoration succeeds
without error. This is done by restoring to an alternative filename and once
proven, casting the restored file away (deleting it). BUT restoring to the
original filename requires that no user is accessing the DB from before the
point of starting the backup until after the point of successful restore.

1. ensure users are disconnected (force them if required by stopping the
2. rename data file
3. start service again (users who try to connect get an error)
4. backup and restore to another alternate name
5. rename successful restore to original filename which will immediately
then allow users to reconnect (find the database file again.