Extract energy data from corrupted database

My Home Assistant installation created a corrupted database file storing over half a year of energy data. He’s running again and storing data but the old data is “stuck” in the corrupted DB-file.

My question; is it possible to retrieve the energydata from the DB that is marked as corrupted and add it to the current database? I would really appreciate help! Searching this community didn’t provide an answer (or my search terms were wrong)

Some specs:
HA Core: 2022.6.6
HA Supervisor: 2022.05.3
HA OS 8.2
HA is running on a Raspberry Pi3 with 4GB RAM

No there’s no way to import old data into history short of writing your own SQL script for it. If you have a backup that includes the DB you can restore from that and get most of your data back (everything up until the point the backup was taken). But that’s really the only easy way.

I’m having the same problem. Doesn’t it seem reasonable to store long-term data on an instable and nor resilient database? Can we find a solution to recover data, for example, from the last backup?