gbak -- backup /restore Firebird database
-b [backup option
...] [common option
-c|-r [restore option
...] [common option
is the tool for managing Firebird database logical backup and
In backup mode source
is the path to an existing database and
is the backup file name. If target
the backup is sent to the standard output.
In restore mode source
is an existing backup file and target
the path to a firebird database. If source
is "stdin", the
backup data is expected on the standard input.
Most options can be abbreviated. Below are given the shortest abbreviations as
well as the full versions.
- -user string
- User name to use when connecting to the database.
- -ro string
- -role string
- SQL role to use when connecting to theh database.
- -pas string
- -password string
- Password to use when connecting to the database.
- Use services manager when talking to the database.
- Report each action.
Displays verbose information about what metadata is being processed, what
table is being backed up/restored and how many records are processed.
- -y string
- Redirects status/error messages to the given path.
- Prints full program version number before doing anything
else. Prints server and database version information after connecting to
- Turns on backup mode.
- Converts external tables into tables.
Normally external tables are ignored during backup and restore. With the
-convert option external tables are included in the backup as any
other regular table. When such a backup is restored, these previously
external tables are created as regular tables.
- -fa number
- -factor number
- Blocking factor. Output is written in block of
number bytes. Useful when backing up to a tape.
- Inhibits garbage collection.
Normally Firebird runs a garbage collector when reading through the tables.
Since the backup process reads all the tables, this forces garbage
collection of the whole database. Using this switch speeds up the backup
process and also can help in some cases of backing up damaged
- Ignores records with bad checksums.
This option should be used only when backing up damaged databases.
- Ignores transactions in limbo.
- Backs up metadata only. No table content is included in the
- Uses non-transportable backup format.
Non-transportable backups can be restored only on machines using the same
- Saves old-style metadata descriptions.
- Turns on restore mode.
target database will be created and must not exist.
- -r [o]
- -recreate_database [overwrite]
- Like -create_database, but by adding
"overwrite" any existing database is overwritten.
- Turns on restore mode. Target database is overwritten if it
- -bu number
- -buffers number
- When creating target database, ignore information about
database buffers stored in the backup and use specified number.
- Normally, Firebird uses RLE compression for strings when
storing them on disk. This option turns this compression off.
- Restore indexes in inactive state. This can be used to
restore a backup, containing data inconsistent with foreign key/unique
Note that since version 3.0 gbak leaves any problematic indices in inactive
- Does not restore database shadow files.
- -mo access
- -mode access
- Restores the database with given access.
Valid values for access are "read_only" and
"read_write". The default is to restore the database with its
original access mode.
- Restores the database without its validity constraints.
This includes foreign key, unique and check constraints. Useful for
restoring a backup, containing inconsistent data.
- Commits restoring transaction after each table.
- -p number
- -page_size number
- Override page size stored in the backup. Valid values are
1024, 2048, 4096, 8192, 16384 and 32768.
- Normally, Fireburd reserves some space on each data page
for further use. This reserved space is used for newly inserted data and
for keeping older versions of the data. Having space reserved for this
purpose "near" to the data speeds up modifications. If the
database will be used mainly for read operations, specifying this option
will save disk space.
- -fix_fss_metadata string
- When restoring metadata, in case it is not valid UTF8, try
to convert it from the specified character set. Useful when table
descriptions are given in some national non-UTF8 encoding, which was
possible with Firebird before version 2.5.
- -fix_fss_data string
- When restoring table data, in case a column defined with
UNICODE_FSS character set contains no valid UTF8 (which was possible with
versions of Firebird prior to 2.5), try to convert the data from the
specified character set.
When the target
argument is in the form file_1 pages_1
, the restored database is written in several files with
not bigger than pages_i
pages. This may be useful if the
file system that holds the database file can't handle files above certain
: the file size limit is in pages
: there is no limit on the size of the last file.
- Default value for the -user option.
- Default value for the -role option.
- Default value for the -password option.
gbak -b srv:/database.fdb stdout | gzip > database.fbk.gz
zcat database.fbk.gz | gbak -c stdin srv:/new-database.fdb
Additional documentation about Firebird can be found on the Firebird Project
This manual page was written by Damyan Ivanov email@example.com for the Debian
project. Permission is granted to use this document, with or without
modifications, provided that this notice is retained. If we meet some day, and
you think this stuff is worth it, you can buy me a beer in return.