Subject Re: [firebird-support] Re: Programmatically using GBAK
Author Helen Borrie
> > This is the restore statement, I get the error as indicated below.
> > c:\Program Files\Firebird\Firebird_1_5\bin\gbak -r -v -user SYSDBA -
> > pas masterkey C:\Magus\FBDB\FRED.fbk C:\Magus\FBDB\FRED.fdb
> >
> > I got this error adding the ­y option
> > gbak: opened file C:\Magus\FBDB\FRED.fbk
> > gbak: ERROR: could not drop database C:\Magus\FBDB\FRED.fdb
>(database
> > might be in use)
> > gbak: Exiting before completion due to errors

At 01:33 AM 28/03/2006, Stefan Heymann wrote:

>Jack, in order to restore over an existing database you must combine
>both the -c and -r options.

Not correct. The -c[reate_database] and
-r[eplace_database] switches are mutually exclusive.

However, NOBODY should use the -r switch unless
s/he really knows what s/he is doing. Totally
avoid it until one reaches a point where one is
confident that [dest]R[oy_database is really what one wants to do.

Stefan, possibly what you are trying to say is
that one should recreate the database first,
using the -c switch and a temporary name for the
new database; then connect to it to be sure that
nothing went wrong during the recreation; then,
finally (with both databases RIGHT OFF LINE!!),
rename the old DB file, then rename the new one.

In Fb 2, you're really going to need to be
serious about destroying the old database if
that's your intention. You will have to add a
keyword to the -r switch in order to overwrite.

./heLen