Fixed the last ‘gotcha’ I had in it getting confused about ‘source-of-truth’ resolving. Turns out to be how Plex manages Main vs Blobs DBs.
Taking today off to play my game and relax
Added two much-needed command line options
-n == No Commit (same as the Linux ‘dry run’ flag)
-f == Force even when “Check” fails miserably.
One last round of testing and then DBRepair will have what I’ve always wanted.
– Ability to verify its schemas against itself and repair damage
– Ability to fallback to known-good data when the world crumbles.
A more targeted approach would be something like this…
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db
SELECT id, name from accounts;
This will give you the list of accounts in your db including the id and the name. Find the one you want to delete from your watch history and take note of its id. Then run …
SELECT * FROM metadata_item_views WHERE account_id = 123456789;
DELETE FROM metadata_item_views WHERE account_id = 123456789;
VACUUM;
.quit
123456789 is the account id you want to change that based on your user. Command 1) will list the records, 2) will delete them if your happy and 3) and 4) are just db maintenance after deleting the records.
One thing to beware of is “Sync Your Watch State and Ratings” as these might come back if the user has that enabled on their account. Might be worth deleting the account from your accounts table.
You are not deleting the entire table, but only records for a single user, yet you reset the auto increment counter back to 0, meaning a clash will happen when new records are added
I wasn’t asking for “a bunch of bells and whistles.” I just take exception to someone actively campaigning against it. Sheesh, never mind. Consider me out of this thread.
Folks don’t know how I’m getting hammered for new features.
Sorry my words sounded harsh. didn’t mean that way.
Here’s what’s coming as soon as QA guys bless it.
DBRepair Release Notes
v0.1999.08
* All Platforms - Corrects database owner and permissions not restored after work completed.
- Corrects fatal sql bug which forced v0.1999.06 removal
* DB Checks - Checking databases now goes deep on initial check to find anything broken
or missing. This information is used to guide the rebuild and to inform.
Previously invisible minor damage will surface and be repaired.
* Schemas - Schema repairs from own backups begining this version.
DBRepair now uses its own backups & known schemas to ensure accurate rebuild.
This is still in development so if DBRepair can find nothing to use,
it will tell you so and exit. The complete fallback will be DBRepair.sh style.
* New Command - 'expunge' removes view history left behind by
non-existent user accounts.
* Program flow - Minor flow control flag corrections. Repair will now
fully halt on hard unrecoverable errors (forces REPLACE)
* Integrity Check - Finds missing indexes / triggers during check.
Corrects during repair
* Command line - Now supports two additional command line options
Don't commit changes to live DBs: -n or --nocommit (Linux's 'dry run' option)
Force DBRepair when disasters occur: -f or --force
* User Manual - Realized a "User Manual" will be needed for DBRepair soon.
LOL
EDIT: This build of DBRepair has direct support of PMS 1.40.0 → 1.43.4 built in.
Just spent a while troubleshooting plex server that wont work on my mac only to discover the DBRepair tool that might save the day is down for maintenance. I kept trying to troubleshoot the DBRepair.sh tool only to discover it was 0 bytes and then read the github further. Was just checking here to see if there was a timeline for when it might be back up?
It’s taken a fair amount of effort but it looks like we’re ready for the next round.
I have extended the expiration to 14 days (instead of 7) to allow deeper testing.
You will now find DBRepair fully understands/supports PMS 1.40.0 → 1.43.4
I’ll finish the resolution of “what if” before 1.43.5 (or higher) is released.
Please read the ReleaseNotes in the ZIP file.
Root / Admistrator privileges must be active upon invocation - except macOS
@ChuckPa I downloaded DBRepair v0.1999.08 and unpacked it to the Databases folder. Starting DBRepair.exe in an elevated cmd instantly gives me an error message:
C:\Users\tobia\AppData\Local\Plex Media Server\Plug-in Support\Databases>DBRepair.exe
ERROR: Cannot open Main DB to determine its migration key.
Unhandled edge case encountered. Development in progress. Please contact @ChuckPa
ERROR: Unable to initialise DBRepair. Aborting.
PMS is version 1.43.4.10903 and is not running. Host is a Windows 10 machine.