Making a backup of the SQLite database

75 views
Skip to first unread message

Joachim Puttkammer

unread,
Feb 5, 2024, 3:58:09 AMFeb 5
to weewx-user
Are the instructions from the user's guide still up to date?
"Do not make the copy of the SQLite database while in the middle of a transaction! Schedule the backup for immediately after an archive record is written, and then make sure the backup completes before the next archive record arrives. Alternatively, stop WeeWX, perform the backup, then restart WeeWX."

Rainer Lang

unread,
Feb 5, 2024, 4:04:33 AMFeb 5
to weewx...@googlegroups.com

I don't think it has changed ... why would it ?
It's a reasonable approach for how and when to copy an active database. That's independent of the weewx version.
Safest way is always to shutdown weewx (best immediately after the last archive records were written), then copy, then restart weewx

On 05.02.2024 09:58, Joachim Puttkammer wrote:
Are the instructions from the user's guide still up to date?
"Do not make the copy of the SQLite database while in the middle of a transaction! Schedule the backup for immediately after an archive record is written, and then make sure the backup completes before the next archive record arrives. Alternatively, stop WeeWX, perform the backup, then restart WeeWX."
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/612bb503-dcfa-4e55-8df3-3524422a517fn%40googlegroups.com.

Joachim Puttkammer

unread,
Feb 5, 2024, 11:41:11 AMFeb 5
to weewx-user
When I edit the weewx database with the DB Browser for SQLite and finally click on Write change, I sometimes get the message that the write operation is blocked because the database is busy elsewhere.
Therefore I imagine that copying is not possible as long as weewx is writing data to the DB,
or the copy operation blocks a write from weewx to the database as well.
An operation with the database prevents a second operation.
If this is the case, it would not be necessary to stop weewx before copying.

michael.k...@gmx.at

unread,
Feb 5, 2024, 12:17:21 PMFeb 5
to weewx-user
Are you opening a local copy of a remote database file, an copy it back to the origin, after storing? I did this a lot over the years, using WinSCP and DB Browser for SQLite on Windows, editing a remote database  on a Raspberry Pi. I also encountered this message, although I managed to do the changes in between one archive interval. Now, for editing the database while weewx is running, I use sqlite on the command line on the remote device and run a prepared script with it, timed between archive intervals.

But I never ran into issues copying the database while weewx was running and the copying took place in between two archive intervals. And I (or better: cron jobs) do this hourly.

Reply all
Reply to author
Forward
0 new messages