Subject Re: How can I check if a database is online or shutdown?
Author Adam
--- In firebird-support@yahoogroups.com, Jose Ostos <jay@...> wrote:
>
> I am using firebird 2.0.1 and delphi 7.
>
> I want to to a program a procedure to backup and/or restore a database.
> My program would first do the following:
> a) That only the user doing the backup is logged in
> b) check that the user is only user is SYSDBA
> c) Chech if the database is "online" or "Shutdown". (don't know how to
> do this)
> d) Shudown DB if not already shutdow.
> e) do the operation (backup or restore)
> f) Bring DB Online

This may be unnecessary.

Are you aware that you can do a hot backup while the database is in
use (no downtime)?

Gbak or the service manager in the API can create you a backup file
that contains the database as it stood the moment you created the
backup. It achieves this using MGA, recognising and ignoring changes
that were made after the backup commenced. The main disadvantage is
that on huge databases, it can take a long time. The main advantage is
that it does some garbage collection while it goes, and if you ever
restore that backup it will also have nicely rebuilt indices.

Firebird 2 introduces a new backup tool called NBackup. This basically
puts the database file into mode where any changes are journalled to a
different file, so you can safely copy the file using file system copy
routines. Once complete, Firebird merges the changes back into the
main database file. This is much much faster to backup but you don't
get the garbage collection. Any restored database doesn't enjoy
rebuilt indices either. It does however allow for incremental backups.

In terms of restore, restore it to a different file and rename it once
the restore is complete. That will solve pretty much any connected
during a restore operation style issue.

Adam