Subject Re: [Firebird-Java] FBNBackupManager issue
Author Mark Rotteveel
On 22 Mar 2014 02:16:34 -0700, <hugo.larson@...> wrote:
> Hello,
> I'm experimenting with FBNBackupManager and came across a strange issue.
> I.m running Firebird 2.5
>
> I'm deliberately adding wrong N backup files in my experiments. The
> restore fails with:
> GDS Exception. 335544382. Invalid level 1 of incremental backup file:
> c:\N0002_20140322_0912.nbk, expected 2
> This is fine but I have two problems.
> 1. The bad nbk file locked until I restart the database.
> I want to delete this file without taking down the database.
> 2. The new database file is also locked until i restart the jvm.
> I want to replace this file with another one.
>
> I tried this without any result:
> fBBackupManager.clearBackupFiles();
> fBBackupManager.setDatabase(null);
>
> How can the files be released?

I don't know enough about NBackup to fully answer this. As far as I
understand after restoring with an invalid chain of files the restored
database is actually valid (up to the point where the chain was still
valid), see http://tracker.firebirdsql.org/browse/CORE-1333

The fact the backup file is locked sounds like a bug. That the database
file remains locked sounds like incorrect behavior as well, so you might
want to ask on Firebird-devel if this is intended or a bug (or you could
report it directly on http://tracker.firebirdsql.org/browse/CORE. As far as
I can tell from the available servicemanager API there is nothing that
Jaybird can do to fix this (although Thomas might know more about this as
he wrote FBNBackupManager).

Looking at the documentation you can end the database lock by attaching to
the restored database and using ALTER DATABASE END BACKUP (see
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-ddl-database.html#langrefupd25-alter-db-end-backup
).

Mark