Skip to content

Performing an online backup of a database

An online backup makes a complete copy of a database into a new file. Because it uses SQLite's online backup mechanism, you can back up a database while it is in use — there is no need to close it first.

To back up a database:

  1. Select the database in the tree panel.
  2. Choose Database → Backup from the main menu.

    The Backup database dialog The Backup database dialog

  3. Enter a file name for the backup database.

  4. Click Start to begin.

    The backup file name entered The backup file name entered

While the copy runs, the dialog shows a progress bar with its percentage inside it, and the page it has reached — Copying 4096/51200 pages…. SQLite reports how many pages are left after each batch it copies, so that percentage is a true fraction rather than an estimate, and the window stays answerable throughout.

Start becomes Cancel while a backup is running, and cancelling takes effect within a moment. The partial copy is deleted rather than left behind, so a cancelled backup leaves nothing to tidy up.

Note

If the source database is encrypted, the backup is encrypted with the same key.

The backup uses the SQLite Online Backup API, which copies the contents of one database into another, overwriting the target. The copy is performed incrementally, so the source database only needs to be locked for the brief moments when it is actually being read — allowing other users to keep working while the backup runs.

See also: Performing maintenance operations · Using encrypted databases