Subject Re: [firebird-support] Recovering from nbackup errors
Author Vlad Khorsun
> 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?

Use nbackup -N (unlock). It starts merge process and Firebird will megre delta
into main database file. After it delta will be removed.

> 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,

Yes. Also you may look at header statistics (gstat -h) to see backup state

> and if so should I unlock it and will that fix the problem?