Skip to main content

Which SQLite files do you need when copying a Rust database?

When manually copying a Rust SQLite database, preserve the database with its matching side files from one stopped capture. For a running database, use a tool that takes a consistent SQLite backup.

Keep the database and its changes together

A matching -wal file can contain changes SQLite has already committed that are still missing from the main database. For example, a manual copy of player.blueprints.18.db that skips its existing player.blueprints.18.db-wal could miss recent blueprint unlocks. Your filename may have a different number. Combining the database from one backup with the -wal from another can corrupt the result.

A clean shutdown can leave no -wal file because SQLite put the changes into the main database and removed the side file. Use the files present after a known clean stop. The absence of a side file from a running copy calls for checking how the copy was made.

Make and check a working copy

If you can stop the writers, stop Rust cleanly and stop any separate service using that database. For a manual filesystem copy, copy the database and the side files that still exist, such as -wal, -shm or -journal, with their names unchanged. If the writers need to stay up, use a SQLite-aware backup tool or the plugin's documented export.

  1. Extract the database and its matching files into a new, empty folder. Keep the backup intact, since opening the database can change the working copy.
  2. Use your backup tool's database check if it has one, or run PRAGMA integrity_check in a SQLite tool on the working copy. The expected result is ok.
  3. Use a separate Rust instance or the plugin's test environment to check a known record from near the capture time. A readable database can still be missing the data you need.

Sources

Analytics settings

Analytics are off.

Help improve RustSC with page counts and performance measurements. Privacy details