Subject Re: Can I copy the embedded database file on the fly?
Author Adam
--- In, "Jeff Lynn" <jmlynn@...> wrote:
> I looked up "Alter Database" SQL stmt syntax from the InterBase 6
> Language Reference manual and did not see anything regarding "Alter
> database" with the Start/end backup refrence. It this new inf
> Firebird 1.5x or 2.0?

Hi Jeff,

In my first post I mentioned NBackup was new to Firebird 2 (which is
not considered stable for production release). The syntax Ivan was
mentioning is how it operates, and he confirmed (I think) that you
could do this via a simple SQL statement. It won't be in the IB6
guides because it is new to FB 2.

If you need to provide compatibility with FB 1.5, then using the
services API to backup is the best way. I can tell you how this is
done in Delphi and IBX, but have no idea for other environments. I
would be surprised if it took longer than an hour to locate enough
resources to get you going. The advantages of a proper backup are:

1) No risk that a database in use will be file copied. The semaphore
approach doesn't handle garbage collection, so if you do take this
approach, rename the file first to make sure nothing is writing to the

2) The backup file is smaller and will often compress further to only
10% of the size of the database.

3) As far as the rest of your program goes, the backup just happens
without interfering at all.

NBackup does (or rather will in FB2) freeze the database file when you
issue a begin backup call and start writing changes to a delta file.
You then take a file copy of the database file which is guaranteed not
to be modified. When you are done, you make the end backup call, which
merges the delta file into the database file. I do not know if there
are performance implications (good or bad) to this approach, and this
list is not really the place to discuss NBackup until FB2 is released.