Skip to content

SQLite export consistency guide

SQLite Database WAL Export Consistency: Check the Snapshot Boundary

A copied SQLite database can be missing committed pages when its WAL is left behind. Review the database, WAL, shared-memory state, checkpoint boundary, and schema together before comparing rows.

A SQLite WAL-mode export is a snapshot question, not only a database-file question. Preserve the main database together with its -wal and, where present, -shm state, record how the copy was made, and identify the read transaction or checkpoint boundary. A file that opens successfully can still omit committed changes that live in the WAL, and an export set does not prove accuracy, permission, or fitness for a use. Source dates shown here are documentation retrieval dates, checked 22 October 2026; original publication dates are not established.

  • SQLite documents that committed changes may remain in the WAL and that separating the database from its WAL can lose transactions or corrupt the copied state. SQLite, (opens in a new tab)
  • SQLite file-format documentation treats a hot WAL as part of recovery state, so the main file alone is not a complete evidence packet during an active transaction. SQLite, (opens in a new tab)

Updated

On this page

Treat the export as a set of related files

In WAL mode, the main database file may contain an older page image while committed changes remain in the write-ahead log. A copy of only main.db can therefore open and answer queries while representing an earlier state. Record the base filename, the presence and byte extent of -wal and -shm, the journal mode observed by an owner-approved read, and the copy method. Never infer a clean checkpoint from a file extension or a successful open.

SQLite explains that readers remember an end mark in the WAL for the duration of a read transaction. That makes the read snapshot a first-class field in the review: identify when the transaction began, whether a writer or checkpoint was active, and whether all related files were copied under a controlled boundary. If that evidence is unavailable, state that snapshot consistency is unverified.

Treat the export as a set of related files (table)
EvidenceRecordStop when
main databasename, byte length, hash, header stateOnly a partial copy exists
WAL filepresent, length, hash, last observed frameWAL was omitted or changed
SHM filepresent or intentionally unavailableThe shared-memory state is unexplained
journal modeowner-approved observed valueMode is guessed from suffix
read boundarytransaction start and end mark if knownThe reader snapshot is unknown
copy methodbackup, checkpointed copy, or file copyFiles were copied at unrelated times

Separate frames, commits, and checkpoints

A WAL contains frames for revised pages and commit markers. A checkpoint transfers committed WAL content back into the main database, but a checkpoint can stop around active readers. Record whether the evidence packet was made before, during, or after a checkpoint and whether the WAL was reset or retained. A smaller WAL is not proof that all expected transactions were included; it may reflect a later state or a new connection boundary.

Use a narrow vocabulary in the report: frame observed, commit boundary observed, checkpoint completed, checkpoint status unknown, or recovery required. Do not turn a page checksum or frame counter into a claim that the application-level export is complete. The SQLite, (opens in a new tab) page describes recovery state and file structure; it does not tell you which business rows a particular owner intended to export.

Separate frames, commits, and checkpoints (table)
StateEvidence questionReport if unanswered
frame rangeWhich frames are present and valid?Frame inventory unavailable
commit markerWhere does the last observed transaction commit?Commit boundary unknown
checkpointWas all eligible WAL content copied?Checkpoint completion unknown
reader end markWhich snapshot did the reader use?Read snapshot unknown
recoveryWas a hot WAL recovered?Recovery history unavailable
schema pageDoes schema match the intended release?Schema version unverified

Review schema and copy timing together

A schema query can succeed against an old main file while the WAL contains a newer migration or index page. Preserve schema evidence with the same snapshot boundary as the data observation: table definitions, indexes, foreign keys if enabled, user-defined objects, and a schema version or migration marker if the source has one. Keep SQL text at structural level and redact values and comments that could expose private records.

Copy timing is its own dimension. A file-level hash only proves that one artifact stayed unchanged after hashing. It does not show that main.db, -wal, and -shm came from one consistent point. Link this review to the relational key guide only after the snapshot is bounded; key counts from mixed snapshots can manufacture or hide orphans.

Questions for the owner-approved export note

  • Was the database opened read-only, backed up through SQLite, or copied as files?
  • Was WAL mode active when the copy began and when it ended?
  • Were all related files kept together under one artifact id?
  • Which schema or migration marker belongs to the observed snapshot?
  • Were long-lived readers or checkpoints active during capture?

Use a synthetic file-set worksheet

Exercise the worksheet with invented files and frame numbers. The fixture below is intentionally not a WAL parser. It tests whether the packet names the three file roles, a read boundary, a checkpoint statement, and the unknown states that prevent overclaiming. Keep real database values out of the worksheet; a table name and neutral frame marker are enough to test the contract.

Compare the owner note with the file set rather than filling gaps from SQLite defaults. If main.db is present but main.db-wal is missing, the right result is an evidence hold, not a guessed checkpoint. If -shm is unavailable but the copy method is documented as an SQLite backup, record that fact and ask whether the method guarantees a consistent backup for the intended scope.

Use a synthetic file-set worksheet (table)
Synthetic findingDispositionNext evidence
All three files share capture idcontinue conditionallyConfirm read and checkpoint boundary
WAL omitted from a WAL-mode copyholdRepeat with related files or controlled backup
WAL present but hash changed after captureholdReacquire immutable artifact set
Schema marker differs from packet noteholdResolve migration boundary
Checkpoint and reader boundary documentedcontinueRun structural relationship checks

Synthetic WAL export note

Use a synthetic file-set worksheet code example, Plain text
artifact: sqlite-fixture-01
files: main.db(hash-a), main.db-wal(hash-b), main.db-shm(hash-c)
mode: wal | read_snapshot: end_mark=12 | checkpoint: not observed
schema_marker: migration-synthetic-4 | values: withheld
disposition: retain as bounded evidence; do not claim complete export

Close with a qualified preparation step

Once the related file set, read boundary, frame and commit evidence, checkpoint state, and schema marker are documented, keep the packet structural. A SQLite consistency review does not reconstruct deleted values, repair corruption, establish ownership, or decide whether a collection can be shared. Use the data provenance log for capture history and keep a data card for scope and exclusions.

For a supported non-health collection, with authority to describe the files and a controlled handling boundary, the qualified appraisal path may be a next preparation step. It does not inspect a database, validate a WAL, create a quote, match a buyer, issue a legal opinion, or grant a license. Keep raw database files out of public worksheets and do not upload them merely to test this checklist.

Takeaways

  • Copy main database, WAL, and shared-memory evidence as one bounded set.
  • Record the reader end mark and checkpoint state instead of guessing a snapshot.
  • Keep schema or migration evidence aligned with the data boundary.
  • Use synthetic file sets to test the worksheet before exposing values.
  • Run key and orphan checks only after snapshot consistency is established.

Sources

  1. SQLite: Write-Ahead Logging (opens in a new tab)
  2. SQLite: Database File Format (opens in a new tab)

Use the appraisal path after the technical packet is organized.

It does not parse files, certify evidence, create a quote, match a buyer, issue a legal opinion, or grant a license.