Reputation: 51
I want to backup a firebird database. I am using gbak.exe utility. It works fine.
But, when i want to do a backup from a remote computer, the backup file is stored on the serveur file system. Is there a way to force gbak utility to download backup file ?
Thanks
Upvotes: 3
Views: 5017
Reputation: 101
My answer is not about backup, but about restore, but still maybe helpful for somebody. If you have Windows, have remote network location and want to restore backup from remote .fbk file to remote location via your local machine, you can use this method:
mklink /D C:\LinkName \\NetworkLocation\LocationName
e.g. mklink /D C:\my_share \\10.11.11.123\Some_share
Thus on your local "C:\"
drive will be created a symlink my_share
pointed at network location.
gbak
command like this:"C:\Program Files\...\gbak.exe" -c -v -n "\\10.11.11.123\Some_share\...\someBackup.fbk" "C:\my_share\...\someRestore.fdb" -user sysdba -password masterkey
FYI: In my examples address 10.11.11.123
is IP of your network location.
How to connect to remote FDB
In firebird.conf
set RemoteFileOpenAbility
to 1. This parameter will allow your DBMS connect to DB located in remote folder. Also check that Redirection
parameter is set to 0 or is commented with #.
Download PSTools from https://learn.microsoft.com/en-us/sysinternals/downloads/psexec, unpack it.
From PSTools
folder via CMD (started as admin) execute psexec -i -s cmd.exe
, accept agreement.
In popped-up CMD's window execute whoami
to check that you are now identified as nt authority\system
.
In that window execute such command:
net use z: \\123.111.111.111\my_share /persistent:yes
, where z
is a network drive letter, you want to assign, and 123.111.111.111\my_share
is an address of your network share.
If you will get System error 58
, try to execute command with specifying user/password in quotes like:
net use z: \\123.111.111.111\my_share /persistent:yes /user:"your username" "your password"
If in the future you will need to disconnect that network drive, perform step 3, then execute net use z: /delete
.
localhost
Z:/path_to_FDB/some_db.FDB
Upvotes: 0
Reputation: 109015
I believe you should be able to do this if you use the service manager for the backup, and specify stdout as the backup file. In that case the file should be streamed to the gbak client and you can write it to disk with a redirect.
gbak -backup -service hostname:service_mgr employee stdout > backupfile.fbk
However I am not 100% sure if this actually works, as the gbak documentation doesn't mention this. I will check this and amend my answer later this week.
Upvotes: 0
Reputation: 21
It is always a problem to grab a remote database onto a different remote computer. For this purposes, our institute uses Handy Backup (for Firebird-based apps, too), but if you are preferring GBAK, these are some more ways to do it.
A simplest method is to call directly to a remote database from a local machine using GBAK (I see it was already described before me). Another method is an installation of GBAK to a remote machine using administrative instruments for Windows networks. This method can be tricky, as in mixed-architecture networks (with domain and non-domain sections) some obstacles are always existed.
Therefore, the simplest method is writing a backup script (batch) file calling GBAK and then copying the resulted Firebird file to some different network destination, using a command-line network file manager or FTP manager like FileZilla. It require some (minimal) skill and research, but can work for many times after a successful testing.
Best regards!
Upvotes: 1
Reputation: 4316
Backup is stored on the Firebird Server
gbak -b -service remote_fb_ip:service_mgr absolute_path_to_db_file absolute_path_to_backupfile -user SYSDBA -pass masterkey
Backup is stored on the local machine
gbak -b remote_fb_ip:absolute_path_to_db_file path_to_local_file -user SYSDBA -pass masterkey
see: remote server local backup and gbak documentation
Upvotes: 5
Reputation: 6979
Try this command:
"C:\Program Files (x86)\Firebird\Firebird_2_5\bin\gbak" -v -t -user SYSDBA -password "masterkey" 192.168.201.10:/database/MyDatabase.fdb E:\Backup\BackupDatabase.fbk
Of course you need to update your paths accordingly :)
Upvotes: 0
Reputation: 374
If you have gbak locally, you can back up over a network. Simply specify the host name before the database.
For example:
gbak -B 192.168.0.10:mydatabase mylocalfile.fbk -user SYSDBA -password masterkey
Upvotes: 0