@michael: It seems that our replies have crossed paths. As I wrote, I make copies, and so far there have been no problems. Even if I had copies of the database from the entire previous month, day by day, the error "popped up" in August, and I would have nothing to restore the database from. Fortunately, my backup is the station panel, from which I can import data in CSV format.
However, I managed to repair the database with the command sqlite3 weewx.sdb ".recover" | sqlite3 weewx-new.sdb - unfortunately, the .dump method did not work. czwartek, 1 stycznia 2026 o 20:17:17 UTC+1 [email protected] napisał(a): > Tomasz, I was assuming you were aware of how you persist your data and > know where the database file is located, because your post wasn't like a > total WeWX noobs post would read like. > > If your database file is corrupted, there may be many reasons, a very > common to me personally was using RPi's. Regardless of the storage type, > over the years I had problems with alle generations of RPis, and I've been > using SD-cards, USB Flash drives, SSDs, ... Anyway, if you don't have a > recent copy of your weewx.sdb, you might not be able to recover your data > from the existing image. You could try to export the database als inserts > and see if there is a sane output up until the crash - if it works at all. > > sqlite weewx.sdb .dump > weewx.sdb.sql > Tomasz Lewicki schrieb am Donnerstag, 1. Januar 2026 um 19:36:57 UTC+1: > >> @vince, And this is precisely a constructive suggestion - a >> recommendation that I can use to check something. The result of this check >> is as follows: >> >> stalker@e6540:~$ file weewx.sdb >> weewx.sdb: SQLite 3.x database, last written using SQLite version >> 3040001, file counter 205338, database pages 13895, cookie 0x236, schema 4, >> UTF-8, version-valid-for 205338 >> >> stalker@e6540:~$ echo "pragma integrity_check" | sqlite3 weewx.sdb >> *** in database main *** >> Tree 2 page 10667 cell 2: Rowid 1754505600 out of order >> Fragmentation of 266 bytes reported as 0 on page 10667 >> NULL value in archive.usUnits >> NULL value in archive.interval >> row 132843 missing from index sqlite_autoindex_archive_1 >> database disk image is malformed >> >> Now at least I know where to look. The question is whether (and if so, >> how) it can be fixed without creating the entire database. >> >> Of course, there is still the option of creating a database from scratch >> using CSV files from the station panel, but that's a last resort. I would >> prefer to just fix the existing database, if possible. >> >> PS. I also suspect the SD card in the RPi. >> >> czwartek, 1 stycznia 2026 o 19:19:43 UTC+1 vince napisał(a): >> >>> His suggestion was plenty constructive. If you don’t have a working >>> backup that means you don’t have a good enough backup solution. There >>> were a couple long threads here a while back about how to verify db and >>> what a good backup solution looks like. >>> >>> Verify your db looks like a db then verify it. >>> >>> # file weewx.sdb >>> weewx.sdb: SQLite 3.x database, last written using SQLite version >>> 3026000 >>> >>> # echo "pragma integrity_check" | sqlite3 weewx.sdb >>> ok >>> >>> If it fails you might need to dump and restore the archive table year by >>> year until you determine where something wrong is located. >>> >>> Why did it happen ? Usually bad power to the pi or a failing SD card… >>> >>> >>> -- 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/weewx-user/aa94f003-7e03-4abc-ac05-377095d70c70n%40googlegroups.com.
