SQLite Forum

SIGBUS in sqlite
This worries me, because it suggests you can delete these files while the database is in use.

If SQLite closes the last connection to a database in WAL mode, it deletes the .shm file.  So if you see a .shm file on disk SQLite thinks that one or more connection is still using the database, so you shouldn't delete any of the above files.

If you think a previous run of the database has crashed, and these flies really aren't being used, you can check this by using

"PRAGMA user_version" (or any other operation which requires reading the file)

on the database.  If no other connections are using the database then this will delete the .shm file.