Page 1 of 1

importing database not working

Posted: Wednesday 21 October 2020 15:35
by Duggel
Hello,

I've been using Domoticz on the same Raspberry pi (2B) since 2015, unfortunately about 3 weeks ago the sd-card got corrupt and went into "read-only" mode. Since then Domoticz and some other services went offline (probably because no logging can't be written).
I can acces the data via ssh and ftp but both are very (VERY) slow (booting the old raspberry with the broken sd takes about 30 minutes).

To stay up date I bought a new raspbery (4B) and flashed a blanc installation to a new sd, installed domoticz, etc.
So far so good, but when trying to "restore" the domoticz.db file the problems started..

I stopped domoticz, renamed the "blanc" domoticz.db file and placed back the domoticz.db from the old pi.
Started domoticz again and... nothing. No devices, no configuration (double checked in private session).

Next step was activating the fresh domoticz.db again and try to upload the backup file via the frontend.
Direct after uploading, domoticz crashed (logging is attached, but this goes way beyond my raspberry knowledge) and doesn't work unless I restore the "blanc" .db file. I tried 1 backup file from the hourly backup-dir, but same result.
What can I try to get back my "old" configuration (please say there are options.... 5 years of scriting, configurating and expanding).

What I noticed:
domoticz.db: 1,4MB
files in hourly backup folder: eveything between 2 and 6MB (why the large difference, is this normal?)

Re: importing database not working

Posted: Wednesday 21 October 2020 16:54
by waaren
Duggel wrote: Wednesday 21 October 2020 15:35 What can I try to get back my "old" configuration (please say there are options.... 5 years of scriting, configurating and expanding).
A first step might be to perform the steps in this topic database check and repair Howto
If the database turns out to be ok then start with all hardware disabled. (see this post )

Re: importing database not working

Posted: Thursday 22 October 2020 8:42
by Duggel
waaren wrote: Wednesday 21 October 2020 16:54 A first step might be to perform the steps in this topic database check and repair Howto
The database was malformed and the repair did some good...
My preferences came back, and so came the scenes, but only about 10 devices (should be at least 300+).
waaren wrote: Wednesday 21 October 2020 16:54 If the database turns out to be ok then start with all hardware disabled. (see this post )
I tried "update hardware set enabled = 0 ;" but this query takes ages (can't be good).
Now I ran a simple COUNT on the hardware table... after 10 minutes stil no output (console only shows ...> )
I guess there's something wrong with this table. I wil Google... but if someone knows how to check/repair you're welcome to share.

Re: importing database not working

Posted: Thursday 22 October 2020 8:44
by waaren
Duggel wrote: Thursday 22 October 2020 8:42 I tried "update hardware set enabled = 0 ;" but this query takes ages (can't be good).
Now I ran a simple COUNT on the hardware table... after 10 minutes stil no output (console only shows ...> )
I guess there's something wrong with this table. I wil Google... but if someone knows how to check/repair you're welcome to share.
Happy to help. If you send me a PM with a link where I can download your database (or a recent backup), I will have a look.

Re: importing database not working

Posted: Thursday 22 October 2020 14:34
by Duggel
Finally found the problem... Because the SD card had issue's the current domoticz.db + all backups in Hourly and Daily were corrupt.
Luckily the august backup was ok, so I manneged to restore from that one.

The corrupt databases could be repaired, but that didn't mean the database-content was complete/good for domoticz.