How to merge 2 domoticz.db databases?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

How to merge 2 domoticz.db databases?

Post 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?
Last edited by Westcott on Friday 28 August 2015 11:37, edited 1 time in total.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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 ?
Quality outlives Quantity!
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
rjobaan
Posts: 21
Joined: Sunday 06 December 2015 21:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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?
klontje
Posts: 19
Joined: Sunday 01 September 2013 13:16
Target OS: Windows
Domoticz version:
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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.
rjobaan
Posts: 21
Joined: Sunday 06 December 2015 21:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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?
rjobaan
Posts: 21
Joined: Sunday 06 December 2015 21:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Contact:

Re: How to merge 2 domoticz.db databases?

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest