Hello,

Seems to me if your backup program does
a "BEGIN EXCLUSIVE" before doing the
file copy then you should be fine.  Just
my guess though.

I believe an exclusive transaction
should ensure that you are the only
writer to the database.

Regards,
Kervin



John Duprey wrote:
I'd like to copy a database that may or may not be in use. Doing a filesystem copy will not ensure a stable copy. Can I use the sqlite3 CLI and some SQL to do this such that I can wrap it up into a script or do I need to write my own program, that gets a lock and re-creates the DB in a new file? I'd like to avoid dumping the database and importing it into a new. My DB is 400M and growing so I'd like to avoid dumping such a large amount of data. What I'd like is a safe binary copy.

From a previous post, I have seen someone suggest this:
attach 'foo.db' as bar;
create table baz as select * from bar.baz;
detach bar;
If I wrapped this in a loop for all tables it would probably do the trick. Can this be done from the sqlite3 cli or will it have to be done in code.?

I appreciate any suggestions.

Thank you,

-John


Reply via email to