SQLite Forum

In-memory database from sqlite file
Login
You are probably correct that it would not be possible to accomplish when the database is locked for exclusive use. The reason things like .schema don't work in that context is because the database is locked, but the different SQLite instances know how to cooperate to indicate the locked status. Other processes (such a copying the file) don't know how to cooperate, and thus might get an inconsistent state of the database while it is being updated by another process.

If there is some data in the database that you need to access even while it is locked, it might make sense to have the process that locks the database for exclusive access be the one that is responsible for making a copy of the relevant data for third parties to use. Or find a way to not hold long running exclusive locks. What journal mode are you using? Perhaps it would be adequate to have one lock running write lock and everyone else could hold read locks on the data, in which case maybe wal mode would work (if all the processes are on the same computer).