Subject Re: [firebird-support] Can I copy the embedded database file on the fly?
Author Ann W. Harrison
Jeff Lynn wrote:
> Hi,
>
> Is it safe to make a file copy of the embedded database file ***.fdb
> while the application is still connected to that file?

Probably not.
> The
> applications is multi-threaded but access to the database is
> synchronized by the use of semaphore and all changes to the database
> via insert/update/delete are commited immediately before releasing the
> semaphore by the accessing thread.

That's interesting... why not just use a connection per thread and
let the system handle the concurrency? However, that semaphore could
be your salvation. If you can seize the semaphore before starting
the copy and hold it until the copy is complete, you would avoid the
problem inherent in copying a file that's subject to positioned
updates, which is getting half of a pair of related updates. Your
application makes a change that affects page 12 and page 1200.
the copy has already passed page 12 before the update starts, but
copies the new version of page 1200 that has a bad reference back
to page 12. If you can shut off updates for the duration of the
copy, you'll be ok.

Regards,


Ann