I have SABnzbd installed on three computers, the last one being the only one I will use going forward. I would really like this most recent installation (4.1.0) to contain the histories of all three installations; thousands of dl's in total. Is there any way I can combine all three histories into the latest installation?
Thanks!
Dan
Combining Histories from 3 installations
Forum rules
Help us help you:
Help us help you:
- Are you using the latest stable version of SABnzbd? Downloads page.
- Tell us what system you run SABnzbd on.
- Adhere to the forum rules.
- Do you experience problems during downloading?
Check your connection in Status and Interface settings window.
Use Test Server in Config > Servers.
We will probably ask you to do a test using only basic settings. - Do you experience problems during repair or unpacking?
Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Re: Combining Histories from 3 installations
Not from SABnzbd itself.
But: history is in .sabnzbd/admin/history1.db, which is a sqlite3 database.
So maybe you can merge with sqlite3 or sqlitebrowser ?
See https://stackoverflow.com/a/9349763
But: history is in .sabnzbd/admin/history1.db, which is a sqlite3 database.
So maybe you can merge with sqlite3 or sqlitebrowser ?
See https://stackoverflow.com/a/9349763
-
vthokies96
- Newbie

- Posts: 2
- Joined: August 6th, 2024, 5:48 pm
Re: Combining Histories from 3 installations
So I went through this process and learned a few things to share in case anyone else runs into issues.
Before merging, just try re-creating a single DB, with no merging at all:
Starting sabnzbd with this new DB resulted in some errors for me about duplicate column names or some such and it created an empty DB to use. The errors were nonsense because sqldiff showed no diffs and the file sizes were the same. However, plain diff did report binary differences. As it turns out, there were a few bytes in the headers that were different, but at least in my case, the only one that mattered was the "user version" starting at bytes 60-63. Modifying it to match the original allowed sabnzbd to load with the new DB correctly. Makes sense as it's ignored by sqlite and is application-specific. I can't post URLs, but search for "sqlite database file format" on the details.
That was the biggest head scratcher. You also need to modify each SQL file that gets generated from the .dump step, though this wasn't hard to figure out based on the error messages:
Before merging, just try re-creating a single DB, with no merging at all:
Code: Select all
$ cp history1.db history1.db.bak
$ sqlite3 history1.db .dump > /tmp/dump1.sql
$ sqlite3 new_history1.db < /tmp/dump1.sql
$ cp new_history1.db history1.db
That was the biggest head scratcher. You also need to modify each SQL file that gets generated from the .dump step, though this wasn't hard to figure out based on the error messages:
- Make sure all CREATE TABLE statements have the IF NOT EXISTS clause.
- In each INSERT INTO statement, modify the IDs to be unique; each dump will start with ID 1, but the merged will need to have unique IDs.
- Make sure the CREATE TABLE statements have matching schema (columns). My oldest DB was missing a column the newer ones had (archive). If you have to do this step, make sure to add appropriate NULL values (or whatever defaults) into each INSERT INTO statement.
Re: Combining Histories from 3 installations
Well done. Impressive.