Page 1 of 1

How to merge 2 domoticz.db databases?

Posted: Thursday 27 August 2015 21:32
by Westcott
Up until 4 Aug my Windows database was in C:\Program Files (x86)\Domoticz
Then I 'updated' to Windows 8.1
Since then a new database was created in C:\ProgramData\Domoticz

How can I merge the 2 databases to get all of the old and new data?

If they were Windows SQL Server dbs I would use sql to select from one and bulk load into the other.

Any helpful suggestions?

Re: How to merge 2 domoticz.db databases?

Posted: Friday 28 August 2015 7:55
by gizmocuz
Even if it was SQL, you would have different ID's for all tables.

The paths you mentioned are the same
C:\ProgramData\Domoticz (Up until 4 Aug)
C:\ProgramData\Domoticz ( 'updated' to Windows 8.1)

it will be a manual job, and i suggest making a backup of both databases of course.
In the database that has the least data, change all *_calendar data to match the right DeviceRowID

You can use SQLite Expert Personal edition for this.

For example, in your old database your 'Outdoor Light' had DeviceRowID=123 and in your new database it has DeviceRowID=50

Then copy/paste it from one database to the other

Did you not noticed this 24 days ago ?

Re: How to merge 2 domoticz.db databases?

Posted: Friday 28 August 2015 11:42
by Westcott
Thanks, I've corrected the old path.
It took me a while to find the new database, although I'd noticed that all history before 4 Aug was missing.
Fortunately I was a .Net and MS SQL Server developer before I retired.

Re: How to merge 2 domoticz.db databases?

Posted: Tuesday 15 December 2015 19:58
by rjobaan
If I make daily backup of the domoticz.db then I have only daily data right? So how can I merge them to get one database with all data instead of separate daily databases?

Re: How to merge 2 domoticz.db databases?

Posted: Wednesday 16 December 2015 20:23
by klontje
rjobaan wrote:If I make daily backup of the domoticz.db then I have only daily data right? So how can I merge them to get one database with all data instead of separate daily databases?
No, daily backups backup the whole database.

Re: How to merge 2 domoticz.db databases?

Posted: Thursday 17 December 2015 21:34
by rjobaan
but if I check the domoticz.db I can not find all the data only from one day.
I just copied the db into my pc and opened in SQL light and check the table Meter or table MultiMeter and I only see data of 24 hours?

Could you please explain what you mean ? I still think I need to backup every day the domoticz.db and combine them somehow

How are you guys doing this? I am still wondering how you save the data of every day?

Re: How to merge 2 domoticz.db databases?

Posted: Sunday 10 January 2016 10:50
by rjobaan
Am I correct that the domoticz.db has only a daily, monthly and yearly data? So not the daily data for an whole year right? I make a back up of everything but still the db consists daily data, so to get daily data for a whole month you need to merge the db? How can I do that?