Locking the database and making the backup yourself
A typical session in which you make your own backup goes as follows:
-
Lock the database with the
-L
(lock) switch:nbackup [-U user -P password] -L database
-
Now copy/backup/zip the database file to your heart’s content, with your own choice of tools. A simple file copy is also possible.
-
Unlock the database with
-N
(uNlock), or — since Firebird 3.0 —-UN
:nbackup [-U user -P password] -N database
The last command will also cause any mutations — which have been written to the delta file — to be merged into the main file.
The backup you made contains the data as they were at the moment the database was locked, regardless how long the locked state has lasted, and regardless how long you may have waited before making the actual backup.
Comments:
-
Instead of a database filename you may also specify an alias.
-
The
-U
and-P
parameters may be omitted if the envarsISC_USER
andISC_PASSWORD
are set, if you are root on a Posix system, or if trusted authentication under Windows permits it.For a detailed description see the comments under Making full backups. -
Starting with Firebird 2.5, instead of
-P password
you may also use-FE filename
. -
Both
-L
and-N
(-UN
) make a regular connection to the database, so in Firebird 2.1 and above it may be wise to add the-T
(or-NODBTRIGGERS
) parameter (see Suppressing database triggers). -
If you’re locking a raw-device database with Firebird 2.1 or above, the
-S
option can be very helpful;see [nbackup-lock-unlock-rawdevices]. -
You can optionally add
-Z
to have version information printed on the first line of the output.
Warning
|
What goes for backup/restore also applies to the lock/unlock switches: do not use them on multi-file databases.Until things have changed, don’t let nbackup loose on multi-file databases at all! |