SQLite Forum

In-memory database from sqlite file
Consistency is assured by use of either the rollback journal or the wal file depending on the journaling mode. The two files together (the main db and the rollback journal/wal file (if they exist)) are what makes up a complete database which is recoverable. You can be in the middle of writing to the main file and have the main file completely messed up, but because we made a backup copy to the rollback journal, then we can recover if everything dies while we're mucking around in the main file.

Have you ever done the case of "let me make a copy of this before I edit it in case I mess something up"? The rollback journal is basically that, but at the page level rather than the whole file level. So at any given point in time, the contents of the main file could be completely broken because we're making changes, but it's ok because we made a copy over there of everything we touched in case we need it to get the original back.

Since you're completely ignoring the locking mechanism and just taking the file contents by brute force whether the process using it is done cleaning up after itself or not, then you can't be sure what you're grabbing is complete.