FirebirdSQL logo

Restore Switches

Note

When running a gbak command, if the first filename is a database backup filename then gbak will default to running a recovery of the database provided that you specify one of -⁠c[create database], -⁠rep[lace_database] or -⁠r[ecreate_database] in order to make your intentions clear.The database will be restored to whatever filename is specified as the second filename on the command line.

Note

You may read the backup data directly from standard input rather than a backup file.In this case, you must specify stdin as the backup filename.You could pipe a gbak backup operation directly to a gbak restore operation to clone a database without needing an intermediate backup file.An example is given later in this manual.

When carrying out a restore or replacement of a database, the following switches, in addition to the common ones above, will be of use:

-⁠C[REATE_DATABASE]

Restore to a new database.

This switch creates a new database from the backup file.The database file must not exist or the restore will fail.Either this switch or -⁠rep[lace_database] or [gbak-cmdline-recreate-database] must be specified.

-⁠N[O_VALIDITY]

Do not enable check constraints.

This switch is similar to the -⁠i[nactive] switch above, except, it disables all check constraints in the restored database.

-⁠O[NE_AT_A_TIME]

Restore table data with a transaction per table.

This switch restores data one table at a time, using a transaction per table.This can be useful when a previous restore failed due to data errors.Normally, a restore takes place in a single transaction with a single commit at the end of the restore.If the restore is interrupted for any reason, an empty database is the end result.Using the -⁠o[ne_at_a_time] option uses a transaction for each table and commits after each table has been restored.