Recover Deleted SQLite Records

Deleted SQLite records can sometimes be recovered if their bytes still survive. Start with a working copy of the database and preserve any matching WAL, SHM, or rollback journal files.

One deleted record, verified to the byte

Firefly Unallocated view showing complete recovery of row 4 on page 3 at file offset 0x2FB5.
SQLite cell
39 bytes
Source page
3
File offset
12,213
Firefly SQLite Analyzer 1.0.3.2 in a controlled test on a synthetic 2.02 GiB database.

We deliberately deleted row 4 from a control table in the test database. Firefly found the complete 39-byte cell in unallocated space on page 3 at file offset 12,213 (0x2FB5). The row ID, marker, and source location matched the test manifest. The working copy’s SHA-256 was unchanged after the run.

Read the full 2.02 GiB recovery test or compare complete and partial SQLite recovery results.

How to examine a SQLite database for deleted records

  1. Preserve the file set

    Keep the original files intact. Work from copies of the database and any matching -wal, -shm, or -journal files. Keep their original filenames together.

  2. Choose where to look

    Record what is visible in the live table. Examine the available WAL or rollback journal and check free space in the main file for surviving data. The files and database history determine what you can find.

  3. Verify the finding

    Record the source file, page, and byte offset where available. Compare the content with the table schema, live rows, and any available committed states. Describe partial records by what survived.

Where deleted or earlier SQLite data can survive

A source can contain a current row, an earlier copy, or a fragment. SQLite may reuse the space, and bytes that have been overwritten are no longer available from that location.

SourceWhat to check
WALFrames store page images. Compare the same record across available committed states. A matching SHM file indexes WAL frames.
Rollback journalWhere journal pages survive, look for page images from before a transaction changed them. See the tested journal example.
Freelist pagesPages released for reuse can still hold earlier content. Use the remaining page structure and record bytes to assess what survived.
FreeblocksThe freeblock chain identifies reusable space within a B-tree page. A block’s header can overwrite part of a previous cell.
Unallocated regionCheck the gap between the cell pointer array and the cell content area. It can preserve records or fragments outside the freeblock chain.

Frequently asked questions

Can deleted messages be recovered from a SQLite app database?

Sometimes. An app may hide a message, change a status field, or remove a row. Check the live tables and matching companion files, then assess which record bytes and context survive.

Does a complete recovered record prove it was deleted?

Complete describes the surviving cell. Compare the record with the live table and available committed states. A page split can leave a complete copy of a row that still exists in the table.

Can WAL frames survive a checkpoint?

Yes. A checkpoint copies changes into the main database. Older frames can remain until the file is reused, truncated, or removed. Preserve the matching WAL with the database.

What does SQLite’s .recover do?

SQLite’s .recover command salvages data from corrupt database files and may surface old content. For a forensic finding, verify the recovered data against the source and document its context.

SQLite documentation for .recover

See SQLite recovery in Firefly

In a demo, see how Firefly finds surviving data and traces a record back to its source. To practice the method on your own schedule, see the Guided On-Demand SQLite Forensics course.