Ein Ort, an dem ich meine Erfahrungen sammeln kann

Monat: Oktober 2021

How to get rid of ‚wal-‚ and ’shm-‚ files‘ in sqlite3

sqlite3 supports some temporary files like wal and shm. See https://www.sqlite.org/tempfiles.html for more information.

If some application does not close its corresponding connections properly these files will exists further and make backup routines harder and in my case even impossible.

There is a little hack to process the wal and shm files and get a proper sqlite database file:

user@d16ffbdcfd53:~$ ls
temp.db  temp.db-shm  temp.db-wal
user@d16ffbdcfd53:~$ sqlite3 
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open temp.db
sqlite> .schema
sqlite> .quit
user@d16ffbdcfd53:~$ ls

Then .open and .schema where doing some magic here.

I do not know whats happening here exactly. My used version is:
3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt1

© 2024 Jonas' Blog

Theme von Anders NorénHoch ↑