SQLite Forum

Hot backup database in WAL mode by coping
Don't do that.  Opening SQLite files using anything but the SQLite API leads to unexpected locks and errors.  Plus you don't know how to ensure that a SQLite database file and a WAL file are 'compatible'.

If you're trying to capture the changes to a file, you might find this useful:

Alternatively, call your own function instead of the SQLite one to execute changes.  Your function logs the SQL command, then calls the SQLite to execute it.