> Fetch the index of every Tonbo docs page as Markdown at https://tonbo.dev/llms.txt

# Backups

Last updated 29 October 2026

Use this to take a database out of Tonbo, into another SQLite tool or another service, or to keep a copy you can go back to after a mistake of your own: export a database to a plain SQLite file, and find the copies an open moved aside.

Tonbo keeps what your program commits, mistakes included: a statement that deletes the wrong rows commits like any other, and a deleted database cannot be brought back (see [Delete a database](https://tonbo.dev/docs/databases/manage.md#delete)). An export you took before is the copy to go back to.

## Export a copy

Export the database from the process that has it open. The export is a plain SQLite file, which opens without the extension, in any SQLite tool. Keep it wherever you need it, such as before a migration you may want to undo. The files in the cache root are not plain SQLite files, so export rather than copy them.

```js
// On a connection open() returned.
db.prepare("VACUUM INTO ?").run("/backups/notes-2026-10-20.db");
```

## Copies an open moved aside

When an `open` cannot keep a local copy that holds data, for example after the database was restored to an earlier point, it moves the copy aside into `salvage/` in the database’s directory of the cache root, as a plain SQLite database with a `manifest.json`, and `db.status().salvage` lists it. When the database was deleted, `open` fails with `not_found` and leaves the local copy as it is.
