| Firebird Documentation Index → Gbak - Firebird Backup & Restore Utility → Gbak Caveats |
![]() |
The following is a brief list of gotchas and funnies that I have detected in my own use of gbak. Some of these are mentioned above, others may not be. By collecting them all here in one place, you should be able to find out what's happening if you have problems.
If you do not specify a mode switch such as
-b[ackup] or -c[reate]
etc, then gbak will perform a backup as if
the -b[ackup] switch had been specified -
provided that the other switches specified are correct for a
backup.
This detection of whether you are attempting a backup or a
restore means that if you use the -z command
line switch to view gbak information, then
you will create a backup - and overwrite the
backup file you supply - if the command line also has a database name
and a backup file name present. This assumes that there is a way for
gbak to determine the username and password
to be used - either as command line parameters or via defined
environment variables.
Only a SYSDBA or the owner of a database can take a backup of the
database, however, any authenticated user can
restore a database backup using the -c[reate]
switch. This means that you must make sure you prevent your backup files
from falling into the wrong hands because there is nothing then to stop
unauthorised people from seeing your data by the simple process of
restoring your backups onto
their server.
The database restore will fail, of course, if the user carrying it out is not the database owner and a database with the same filename already exists.
The -y suppress_output switch is supposed
to cause all output to be suppressed. Similar in fact to running with
-v[erify] not specified. However, all it seems to
do is cause the output (according to the
-v[erify] switch setting) to be written to a file
called suppress_output, however this only works
once because the next run of gbak with -y
suppress_output will fail because the file,
suppress_output, already exists.
It is possible that this problem was introduced at version 2 for
Firebird, because both 2.0 and 2.1 versions actually use the
-y suppress switch rather then -y
suppress_output. Using this (shorter) option does work as
intended and the output is indeed suppressed.
If you specify a log file name with the -y <log
file> switch, and the file already exists, then even
though the firebird user owns the file, and has write permissions to it,
gbak cannot overwrite it. You must always
specify the name of a log file that doesn't exist. On Linux systems, the
following might help:
tux> # Generate unique dump and logfile name.
tux> FILENAME=employee_`date "+%Y%m%d_%H%M%S"`
tux> # Shut down and Backup the database
tux> gfix -shut -tran 60 employee
tux> gbak -backup employee /backups/${FILENAME}.fbk -y /logs/${FILENAME}.log -v
The above is quite useful in as much as it prevents you from overwriting previous backups that may be required. The downside is that you now need to introduce a housekeeping system to tidy away old, unwanted backups to prevent your backup area filling up.
| Firebird Documentation Index → Gbak - Firebird Backup & Restore Utility → Gbak Caveats |