On Apr 5, 2010, at 5:42 PM, Joshua Redstone wrote:

> Hi sqlite-users,
> I'm looking for an easy way to backup a sqlite3 database while it is  
> in use.  If I could get away with linux 'cp', that'd be easier than
> writing c++ code according to the online backup API 
> (http://www.sqlite.org/backup.html 
> ), and also it has the advantage that it would not block writes.   
> Initially I thought that 'cp' would be safe because sqlite is crash- 
> safe, but then I realized that 'cp' is not atomic, so it's possible  
> it won't work.
> Thoughts?

Right.  "cp" is not atomic.  "cp" will *usually* work, but sometimes  
you will get unluck and the database will change in the middle of the  
"cp" and what you end up with will be the first have of one database  
and the second half of a different database.

The backup API is safer.



> Thanks,
> Josh
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

D. Richard Hipp
d...@hwaci.com



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to