Some backup and restore examples
Go Up to Performing backups and restores using the gbak command
The following examples use forward slashes exclusively. InterBase accepts either forward or backward slashes for paths on Wintel platforms.
Database backup examples
The following example backs up foo.ib
, which resides on the server jupiter
and writes the backup file to the current directory of the client machine where gbak
is running. foo.ib
can be either a single-file database or the name of the first file in a multifile database. Using this syntax (without the -se
switch) copies a lot of data over the net.
gbak -b -user joe -password blurf@ jupiter:/foo.ib foo.ibk
The next example backs up foo.ib
, which resides on the server jupiter
and writes the backup file to the C:/archive
directory on the client machine where gbak
is running. As before, foo.ib
can be a single file database or the name of the first file in a multifile database. This syntax causes the same amount of network traffic as the first example.
gbak -b -user joe -password blurf@ jupiter:/foo.ib C:\archive\foo.ibk
The next example backs up the same database on jupiter
, but uses the -se
[rvice
] switch to invoke the Service Manager on jupiter
, which writes the backup to the \backup
directory on jupiter
. This command causes very little network traffic and is therefore faster than performing the same task without the -se
(-service
) switch. Note that the syntax (jupiter:service_mgr
) indicates a TCP/IP connection.
gbak -b -user joe -password blurf@ -se jupiter:service_mgr /foo.ib /backup/foo.ibk
The next example again backs up foo1.ib
on server jupiter
to multiple files in the /backup
directory on jupiter
using the Service Manager. This syntax backs up a single file or multifile database and uses a minimum of time and network traffic. It converts external files as internal tables and creates a backup in a transportable format that can be restored on any InterBase-supported platform. To back up a multifile database, name only the first file in the backup command. In this example, the first two backup files are limited to 500K. The last one expands as necessary.
gbak -b -user joe -pass blurf@ -co -t -se jupiter:service_mgr /foo1.ib/backup/backup1.ibk 500k /backup/backup2.ibk 500k /backup/lastBackup.ibk
Database restore examples
The first example restores a database that resides in the /archive
directory on the machine where gbak
is running and restores it to jupiter
, overwriting an existing (but inactive) database.
gbak -r -user joe -pass blurf@ C:\archive\foo.ibk jupiter:/foo.ib
The next example restores a multifile database from the /backup
directory of jupiter to the /companydb
directory of
jupiter
. This command runs on the server by invoking Service Manager, thus saving time and network traffic. In this example, the first two files of the restored database are 500 pages long and the last file grows as needed.
gbak -r user -joe -pass blurf@ -se jupiter:service_mgr /backup/foo1.ibk /backup/foo2.ibk /backup/fooLast.ibk /companydb/foo1.ib 500 /companydb/foo2.ib 500 /companydb/fooLast.ib
The next example executes on server Jupiter using Service Manager and restores a backup that is on Jupiter to another server called Pluto.
gbak -r user -joe -pass blurf@ -se jupiter:service_mgr /backup/foo.ibk pluto:/companydb/foo.ib