Subject Recovering from nbackup errors
Author Tom Munro Glass
I'm currently developing some code that will do automatic database backups for
a 24x7 datalogging application using nbackup. It will do full level 0 backups
just after midnight on 1st of each month, incremental level 1 backups just
after midnight every day except the 1st of the month, and a level 2 backup
every hour except at midnight.

My code was working, but then stopped working and I discovered that a copy of
the delta file had been left in the database folder. I probably caused the
problem by stopping my code or Firebird server while nbackup was working -
these things happen in a development environment. But my question is how can
I recover from this in a real life environment?

Suppose there is a power failure, or someone stops Firebird while nbackup is
running, and so it doesn't complete the backup operation. Next time I do a
backup, I can check if the delta file exists, but how should I handle this
situation?

I don't mind losing transactions that are only recorded in the delta file, so
can I just delete it? Does the existence of the delta file imply that the
database is locked, and if so should I unlock it and will that fix the
problem? The most important requirement is that the main database does not
get corrupted, and that I can continue updating it.

Regards

Tom Munro Glass