Rich Shepard uttered:

On Fri, 9 Feb 2007, Mikey C wrote:

This might be a dumb question, but is taking a backup of a live database
simply a matter of copying the file to a backup device/drive?

 Yes. It's a regular file to your OS. As a matter of fact, you can copy the
file to another name and open that other name to see the same tables and
data as with the original. That's how I keep a backup of the database I'm
developing.


No, no, no! Copying the file is not atomic, and a live database may be updated part way through the copy.

Use the sqlite shell .dump command, which will implement the necessary locking:
$ sqlite3 db.file .dump  > backup.sql

The backed up file is a SQL script that will restore the database.


Christian

--
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to