Debian: Firebird Database Server
From ReceptiveIT
Contents |
Backup and Restore
A "normal" Backup
gbak -v -t -user SYSDBA -password "masterkey" dbserver:/db/warehouse.fdb c:\backups\warehouse.fbk
Backup with output to a logfile
del c:\backups\warehouse.log gbak -v -t -user SYSDBA -password masterkey -y c:\backups\warehouse.log dbserver:/db/warehouse.fdb c:\backups\warehouse.fbk
A "normal" Restore
gbak -c -v -user SYSDBA -password masterkey c:\backups\warehouse.fbk dbserver:/db/warehouse2.fdb
Restore to an already existing database (Firebird 1.0, 1.5)
gbak -c -r -v -user SYSDBA -password masterkey c:\backups\warehouse.fbk dbserver:/db/warehouse.fdb
Restore to an already existing database (Firebird 2.0)
gbak -r o -v -user SYSDBA -password masterkey c:\backups\warehouse.fbk dbserver:/db/warehouse.fdb
Create a read-only database
gbak -c -v -mode read_only -use_all_space -user SYSDBA -password masterkey c:\backups\warehouse.fbk c:\files\warehousedb.fdb
Multi-file backups
Syntax for backup
gbak [options] <database> <target file 1> <size 1> <target file 2> <size 2> ... <target file n>
NOTE: Do not specify a size for the last file. It will always be filled to take up what is left over, no matter how large.
Size can be given in bytes (8192), kilobytes (1024k), megabytes (5m), or gigabytes (2g) Syntax for restore
gbak -c [options] <source file 1> <source file 2> ... <source file n> <database> Restoring to a multi-file database
gbak -c [options] <source file> <db file 1> <size 1> <db file 2> <size 2> ... <db file n>
NOTE: Do not specify a size for the last database file. It can always grow unlimited to take up the rest.
Size can be given in bytes (8192), kilobytes (1024k), megabytes (5m), or gigabytes (2g) Restoring from a multi-file backup to a multi-file database
gbak -c [options] <source file 1> <source file 2> ... <source file n> <db file 1> <size 1> <db file 2> <size 2> ... <db file n> Backing up and Restoring the Security Database Firebird 1.0, 1.5
You can perform a "normal" backup of the security database. The security database resides in the Firebird directory. It is named
* ISC4.gdb in Firebird 1.0 and * security.fdb in Firebird 1.5.
Firebird 2.0
Firebird 2.0 does not allow normal database access to the security database. Its name is now security2.fdb
The only way to access the security database is via the Service Manager. As GBAK can also use the Service Manager (Option -se), you can run a backup using this option. However, the backup file will also be written to the server machine.
General Syntax:
gbak <options> -user <username> -password <password> -se <servername>:service_mgr <sec-db-name> <backup-filename>
Example:
gbak -v -t -user sysdba -password masterkey -se dbserver:service_mgr c:\Programme\Firebird2\security2.fdb C:\Backups\Security2.fbk
(in this case, Security2.fbk will be written to the C:\Backups folder of dbserver)
When your database server listens on a non-default port:
gbak -v -t -user sysdba -password masterkey -se dbserver/3051:service_mgr c:\Programme\Firebird2\security2.fdb C:\Backups\Security2.fbk
Firebird 2.1
In Firebird 2.1 there is a new option -no_dbtriggers that suppresses database triggers from running during backup/restore. So you can suppress any unwanted behaviour for the connection that GBAK needs to establish for the database. Restoring the Security Database
It is not possible to restore the security database while Firebird is running. In case your security database gets destroyed, this is what you can do:
* Stop the Firebird service/daemon * Replace the current security database with a new one. If anything else fails, re-install the Firebird server * You should now have a working SYSDBA login and password. If not, re-install the Firebird server ... * Start the Firebird service/daemon * Using GBAK, restore your backup of the security database to a temporary place (like C:\Temp\security.fdb) * Stop the Firebird service/daemon again * Now copy the file from the temporary place to the correct place in the Firebird folder * Start the Firebird service/daemon * Now you should have your "old" security database back. * Good Luck! :-)
Upgrading a Security Database to Firebird 2.0
There is a special chapter "Dealing with the New Security Database" about this in the Firebird 2.0 Release Notes, which get installed to the doc subdirectory of your Firebird directory. You should also take a look at the misc\upgrade\security\security_database.txt file, which explains in detail how to do it.

