Subject Re: Can I copy the embedded database file on the fly?
Author Adam
--- In, Nando Dessena <nando@...> wrote:
> Ann,
> A> Another day when I should have stayed in bed. Ivan is completely
> A> right. As long as there is no concurrent writing going on the
> A> copy is safe.
> this is exactly the problem. Can you guarantee that there is no
> concurrent writing? You wrote "If you can shut off updates for the
> duration of the copy, you'll be ok.". What about the garbage
> collection thread? I think the OP would be well advised to use the
> safe tools (gbak, nbackup) that exist.

I agree here with Nando. Theoretically, it is completely safe to use a
file system level copy utility to backup a database that is in use
providing nothing is flushed to disk during the time of the copy. The
problem is that you can not 100% guarantee that this is the case, and
any backup solution where you can't have confidence you won't have a
corrupt backup is not a good one for mine.

I gave some more thought to this problem, and my theory of using
NBackup would not work because of the embedded engine, unless your
process disconnected totally from the database, unless NBackup is
available through some API that I am not yet familiar with.

Creating a thread and connecting to the services API to do a backup
from that thread is the best solution as it guarantees the backup will
not be corrupt and does not interfere at all with your application.