Remote Backups & Restores
Firebird’s gbak
utility can make backups of a remote database.To do this, you need to connect to the service manager running on the remote server, this is normally called service_mgr
.The following example shows the Firebird employee
database on server tuxrep being backed up from the server tux.The backup will be written to the remote server, in other words, the backup file will be created on the tuxrep server and not on the tux one.The network protocol in use is TCP.
tux> # Backup the reporting database on remote server tuxrep. tux> gbak -backup -service tuxrep:service_mgr employee /backups/remote_backup.fbk
The backup file will have the same owner and group as the Firebird database server — on Unix systems at least.
It is also possible to restore a remote database in this manner as well, and gbak
allows this.
tux> # Restore the read-only reporting database on remote server tuxrep. tux> gbak -r o -mode read_only -service tuxrep:service_mgr \ /backups/remote_backup.fbk employee
Note
|
The above example uses the handy Unix ability to split a long line over many shorter ones using a backslash as the final character on the line. |
As ever, you are advised to beware of replacing a database in case there are problems during the restore.The example above recreates the existing database in read-only mode but this need not always be the case.
A remote backup can also be run on the database server itself!On Windows, this makes no difference, but on Unix systems, this local-remote method of backups and restores reduces network traffic.The 'remote' server, in this case, is not actually remote it is just the method of running the backup — connecting to the service manager — that implies remoteness.
tux> # Backup the employee database on this server, but pseudo-remotely! tux> gbak -backup -service tux:service_mgr employee /backups/remote_backup.fbk
And corresponding restores can also be run 'remotely':
tux> # Restore the employee database on this server, but pseudo-remotely! tux> gbak -r o -service tux:service_mgr /backups/remote_backup.fbk employee
The format of the parameter used for the -service
switch is different according to the nature of the network protocol and the connection string in use:
- TCP
-
Legacy connection string:
<hostname>[/<port>]:service_mgr
Firebird 3.0 and higher connection strings:# TCP/IP (v4 and v6) inet://[<hostname>[:<port]]/service_mgr # TCP/IP (v4 only) inet4://[<hostname>[:<port]]/service_mgr # TCP/IP (v6 only) inet6://[<hostname>[:<port]]/service_mgr
If port is not specified, port
3050
is used.If hostname is not specified,localhost
is used.It is not possible to specify a port without hostname.To use a IPv6 IP address it must be enclosed in square brackets (e.g.
inet://[::1]/service_mgr
). - XNET
-
Legacy connection string:
service_mgr
(this may also use TCP/IP to localhost instead)
Firebird 3.0 and higher connection string:xnet://service_mgr
XNET is only supported on Windows.
- Named pipes/WNET
-
Legacy connection string:
\\<hostname>[@<port>]\service_mgr
Firebird 3.0 and 4.0 connection string:wnet://[<hostname>[:<port>]]/service_mgr
Support for named pipes (a.k.a. WNET) was removed in Firebird 5.0, and in earlier versions only available on Windows.
Note
|
Since Firebird 4.0, the That means that the minimum connection strings to use the service manager are now:
Be aware that not specifying a value for [gbak-cmdline-service] is not possible.If the commandline has any other options or values after |