Making full backups
To make a full database backup, the command syntax is:
nbackup [-USER user -PASSWORD password] -BACKUP 0 database [backupfile]
For instance, assuming the database is located in C:\Data, and `nbackup.exe ` is in the search of path Windows:
C:\Data>nbackup -BACKUP 0 inventory.fdb inventory_1-Mar-2006.nbk
Or, if Firebird (from version 2.5) is running on non-standard port, in this example, 3051:
C:\Data>nbackup -BACKUP 0 localhost/3051:C:\Data\inventory.fdb C:\Data\inventory-level-0-Jul-2020.nbk -user SYSDBA -pass masterkey
In Firebird 3.0 and higher, in a case of successful completing the backup, the nbackup will print the short statistics:
time elapsed 0 sec page reads 307 page writes 307
-
The backup level 0 indicates a full backup.Backup levels greater than 0 are used for incremental backups;we’ll discuss those later on.
-
Instead of a database filename you may also use an alias.
-
Instead of a backup filename you may also specify
stdout.This will send the backup to standard output, from where you can redirect it to e.g. a tape archiver or a compression tool. -
The
-USERand-PASSWORDparameters may be omitted if at least one of the following conditions is met:-
The environment variables
ISC_USERandISC_PASSWORDhave been set, either toSYSDBAor to the owner of the database. -
You are logged on as root on a Posix system.This makes you
SYSDBAby default. -
Under Windows: Trusted authentication is enabled in
firebird.conf, and you are logged on to the Windows account that owns the database.This is possible in Firebird 2.1 and above. -
Under Windows: Trusted authentication is enabled in
firebird.conf, and you are logged on as a Windows administrator.In Firebird 2.1, this automatically gives youSYSDBArights.In Firebird 2.5 and above, there is the additional condition thatAUTO ADMIN MAPPINGhas been set in the database.
For clarity and brevity, the
-USERand-PASSWORDparameters are not used in the examples. -
-
Starting with Firebird 2.5, instead of
-P password(or-PASSWORD password) you may also use-FE filename(or-FETCH_PASSWORD filename).This will cause nbackup to fetch the password from the given file.With-FE, the password itself doesn’t appear in the command and will thus be better shielded against people who might otherwise pick it up via the command history, thewcommand on Unix or from a script or batch-file. -
In Firebird 3.0 and up, the firing of database triggers can be prevented by specifying the
-NODBTRIGGERSoption.For more information, see Suppressing database triggers. -
In Firebird 2.1 and up, the firing of database triggers can be prevented by specifying the
-Toption.For more information, see Suppressing database triggers.The-Toption was deprecated in Firebird 3.0 in favour of-NODBTRIGGERS. -
Starting with Firebird 2.1.4, it is possible to force direct I/O on or off by specifying
-D ONor-D OFF.For details and background see Direct I/O, elsewhere in this manual. -
The different parameters (
-BACKUP,-USERetc.) may occur in any order.Of course each parameter should be immediately followed by its own argument(s).In the case of-BACKUPthere are three of them: backup level or guid, database, and backup file — in that order! -
If the
-Bparameter comes last, you may leave out the name of the backup file.In that case nbackup will compose a filename based on the database name, the backup level, and the current date and time.This can lead to a name clash (and a failed backup) if two backup commands of the same level are issued in the same minute.
|
Warning
|
Do not use nbackup for multi-file databases.This can lead to corruption and loss of data, despite the fact that nbackup will not complain about such a command. |