FirebirdSQL logo

Restoring a full backup

A full backup is restored as follows:

nbackup -RESTORE database [backupfile]

For instance:

C:\Data> nbackup -RESTORE inventory.fdb inventory_1-Mar-2006.nbk
Comments
  • You don’t specify a level for a restore.

  • When restoring, the -RESTORE parameter must come last, for reasons that will become clear later.

  • Instead of a database filename you may also use an alias.

  • If the specified database file already exists, the restore fails, and you get an error message.

  • Here too, you may omit the name of the backup file.If you do, nbackup will prompt you for it.(Attention! In Firebird 2.0.0 this “interactive restore” feature is broken, leaving you with an error message and a failed restore. Fixed in 2.0.1.)

  • Restoring works purely on the filesystem level and can even be done without a Firebird server running.Any credentials supplied via the -USER and -PASSWORD parameters are ignored.The same goes for passwords read from a file.However, nbackup does try to read the password from the file if the -FETCH_PASSWORD parameter is present, and if an error occurs, the entire operation is abandoned.

Incremental backups

Warning

The incremental backup facility was entirely broken in Firebird 2.1.0, and fixed again in 2.1.1.

Making incremental backups

To make an incremental (“differential”) backup, specify a backup level greater than 0.An incremental backup of level N always contains the database mutations since the most recent level N-1 backup.

Examples:

One day after the full backup (level 0), you make one with level 1:

C:\Data> nbackup -BACKUP 1 inventory.fdb inventory_2-Mar-2006.nbk

This backup will only contain the mutations of the last day.

One day later again, you make another one with level 1:

C:\Data> nbackup -BACKUP 1 inventory.fdb inventory_3-Mar-2006.nbk

This one contains the mutations of the last two days, since the full backup, not only those since the previous level-1 backup.

Note

The previous incremental backup of any level must be completed before the start of the next incremental backup, otherwise nbackup execution will not do the desired backup, and return error "Database is already in the physical backup mode".

A couple of hours on we go for a level-2 backup:

C:\Data> nbackup -BACKUP 2 inventory.fdb inventory_3-Mar-2006_2.nbk

This youngest backup only contains the mutations since the most recent level-1 backup, that is: of the last few hours.

Important performance notice

Before Firebird 3.0, all incremental backups (i.e., level 1, 2, etc.) will read the whole database file to locate the changes and store them into a backup file.This can affect the database performance in a case of big databases (100Gb+) and slow disk subsystem (usually, slowness can be noticed on non-SSD drives).Starting from Firebird 3.0, only the changed portion of the database file is read, so incremental backups level 1 and higher are much faster, and reduce impact on database performance.

Note

All the comments that have been made about full backups also apply to incremental backups.

Warning

Again: do not use nbackup for multi-file databases.