A word on the inner workings
Note
|
What follows here is not necessary knowledge to use nbackup.
It just gives a rough (and incomplete) impression of what happens under the hood during execution of nbackup -BACKUP :
|
-
First of all, the main database file is locked by changing an internal state flag.From this moment on, any and all mutations in the database are written to a temporary file — the difference file or delta file.By default, the delta file is created in the same folder as a database file, with the additional extension
.delta
, for example: MyDatabase.fdb.delta -
Then the actual backup is made.This isn’t a straight file copy;restoring must be done by nbackup as well.
-
Upon completion of the backup, the contents of the delta file are integrated with the main database file.After that, the database is unlocked (flag goes back to “normal”) and the delta is removed.
The functionality of steps 1 and 3 is provided by two new SQL statements: ALTER DATABASE BEGIN BACKUP
and ALTER DATABASE END BACKUP
.Contrary to what the names suggest, these statements do not take care of making the actual backup;rather, they create the conditions under which the main database file can be safely backed up.And to be clear: you don’t need to issue these commands yourself;nbackup will do that for you, at the right moments.