Just a little logic: if you want some backup mechanism that won't block writers then what state the backed up database should be in? In the state that was when backup process started or in the state that was when backup process ended? If the former then how would you distinguish file contents that was from the beginning from the one written by somebody in the middle of the process? If the latter then how would you catch changes made in the middle of the process to some parts of database that were already copied?
There's no answers to those questions unless your database engine is a single process one or you blocked away all writers while you are making backup. And the answer to your question is no, you cannot backup SQLite database on-the-fly by issuing a simple 'cp'. Pavel On Mon, Apr 5, 2010 at 5:42 PM, Joshua Redstone <joshua.redst...@facebook.com> 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? > Thanks, > Josh > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users