Restoring a database with gbak
Go Up to Performing backups and restores using the gbak command
For information on restoring tablespaces refer to Tablespace Backup/Restore and Recovery
Use the following syntax to restore a database:
For restoring:
gbak {-c|-r} [options] source dbfile
For restoring to multiple files:
gbak {-c|-r} [options] source dbfile1 size1 dbfile2 [size2 dbfile3 …]
For restoring from multiple files:
gbak {-c|-r} [options] source1 source2 [source3 …] dbfile
By extension, you can restore from multiple files to multiple files using the following syntax:
gbak {-c|-r} [options] source1 source2 [source3 …] dbfile1 size1 dbfile2 [size2 dbfile3 …]
For restoring from Embedded User Authentication backup files:
The USER and PASSWORD server credentials are required to create a database on the server and execute the restore service. The -eua_u[ser] name and -eua_p[assword] text database credentials are required to ensure that only the database owner can restore an EUA database.
Argument | Description |
---|---|
<source> |
Name of a storage device or backup file from which to restore. On UNIX, this can also be |
<dbfile> |
The name of a restored database file. |
<size> |
Length of a backup file or restored database file
|
The following table lists gbak
options that are available when restoring databases.
Option | Description | ||||||
---|---|---|---|---|---|---|---|
-c[reate_database] |
Restores database to a new file. | ||||||
-bu[ffers] |
Sets cache size for restored database. | ||||||
-i[nactive] |
Makes indexes inactive upon restore. | ||||||
-eua_u[ser] name |
Checks for user name before accessing EUA (embedded user authentication) database. The -user and -password options still need to be provided, in addition to your -eua equivalents when restoring an EUA database. Either EUA switch can be omitted if it has an identical value to its counterpart. However it is recommended that the PASSWORD and EUA_PASSWORD should not be the same. | ||||||
-eua_p[assword] text |
Checks for password text before accessing EUA (embedded user authentication) database. The -user and -password options still need to be provided, in addition to your -eua equivalents when restoring an EUA database. Either EUA switch can be omitted if it has an identical value to its counterpart. However it is recommended that the PASSWORD and EUA_PASSWORD should not be the same. | ||||||
-k[ill] |
Does not create any shadows that were previously defined. | ||||||
-mo[de] {read_write | read_only} |
Specifies whether the restored database is writable
| ||||||
-n[o_validity] |
Deletes validity constraints from restored metadata; allows restoration of data that would otherwise not meet validity constraints. | ||||||
-ods[_version] n |
Restores the database to specific major ODS version number. where <n> is a supported major ODS version. The target database engine will have its own allowed major ODS version list. When this option is specified at restore time, it overrides the server-side IBConfig setting DATABASE_ODS_VERSION.
| ||||||
-o[ne_at_a_time] |
Restores one table at a time; useful for partial recovery if database contains corrupt data. | ||||||
-p[age_size] n |
Resets page size to <n> bytes (1024, 2048, 4096, 8192, or 16384); default is 4096. | ||||||
-pas[sword] text |
Checks for password <text> before accessing a database. | ||||||
-r[eplace_database] |
Restores database to new file or replaces existing file. | ||||||
-se[rvice] servicename |
| ||||||
-user name |
Checks for user <name> before accessing database. | ||||||
-use_[all_space] |
Restores database with 100% fill ratio on every data page. By default, space is reserved for each row on a data page to accommodate a back version of an UPDATE or DELETE. Depending on the size of the compressed rows, that could translate e to any percentage. | ||||||
-v[erbose] |
Shows what | ||||||
-va[lidate] |
Use to validate the database when restoring it. | ||||||
-w[rite] {async | sync | direct} |
Overrides a database write mode. The “write” mode is preserved during a backup/restore lifecycle.
| ||||||
-y [file | suppress_output] |
If used with | ||||||
-z |
Show version of |
When restoring a database, keep the following information in mind:
- Anyone can restore a database. However, only the database owner or
SYSDBA
can restore a database over an existing database. - Do not restore a backup over a database that is currently in use; it is likely to corrupt the database.
- When restoring from a multifile backup, name all the backup files, in any order.
- Do not provide a file size for the last (or only) file of the restored database. InterBase does not return an error, but it always “grows” the last file as needed until all available space is used. This dynamic sizing is a feature of InterBase.
- You specify the size of a restored database in database pages. The default size for database files is 200 pages. The default database page size is 4K, so if the page size has not been changed, the default database size is 800K. This is sufficient for only a very small database. To change the size of the database pages, use the
-p[age_size]
option when restoring.
Use the
-service
switch if you are restoring to the same server that holds the backup file. This option invokes the InterBase Service Manager on the server host and saves both time and network traffic.If you specify several target database files but have only a small amount of data, the target files are quite small (around 800K for the first one and 4K for subsequent ones) when they are first created. They grow in sequence to the specified sizes as you populate the database.