SQLite Forum

Question about sqlite backup api
Login

Question about sqlite backup api

(1.1) By qiyinan on 2021-12-31 02:04:11 edited from 1.0 [link] [source]

Hello, all I have a question about the sqlite backup api. I have a online database and it works in WAL mode, so there are three files in the folder, *.db3, *.db3-wal and *.db3-shm. Now, I want to use the backup api to sync the database to a backup folder. After backup, will the wal and shm files in the backup folder?

Thanks

(2) By Larry Brasfield (larrybr) on 2021-12-31 02:01:22 in reply to 1.0 [link] [source]

The backup API creates another DB file which represents the one backed up at an instant in time. It is a logical copy, not a physical, bit-for-bit copy, and users need not worry about accompanying WAL or .shm files. Short answer: No. Medium answer: ... and they need not be there.

Your thread title is a misnomer; there is no problem (beyond your apprehension which the backup API doc should have forestalled.)

(3) By qiyinan on 2021-12-31 02:04:38 in reply to 2 [link] [source]

Thanks for you reply. Correct the title.

(4) By qiyinan on 2021-12-31 02:06:36 in reply to 2 [link] [source]

By the way, do I need running a wal_checkpoint before the backup api?

(5) By Simon Slavin (slavin) on 2021-12-31 17:46:44 in reply to 4 [source]

As Larry wrote, the backup API represents the contents of the database. Not what appears in the database file on disk.