DBRepair development

Absolutely Brilliant. This version repaired the database and was back up and running in under 1 min.

Thanks :slight_smile:
Paul

@sneekyparrot

What was the problem with the DB? (curious)

I just ran it on a synology DSM7. Used the Automatic option and it ran through the checks and found no issues (PMS had been hanging when running scheduled optimization). Problem was that afterwards, I couldn’t get PMS to restart manually. It would try for a few seconds and then shut back down.

@jeby6

Auto will trigger and run when the DB doesn’t pass the structural tests.
It sounds like this is a content issue. This is how it should be and differs from the shell script which forced a rebuild every time.

Hanging during its scheduled optimizations is either their method, a disk space issue, or deeper internal content damage.

Force a repair by using ‘REPAIR’ command.
This will build all the tables regardless of their current status

Sending me a pm of your plex logs will help

Not sure that auto was triggered in my case. When i fired up DB via SSH, it gave me a list of options. I selected 2 - auto. I manually stopped the PMS (because i dont think DB had application rights). It ran its scans and found no issues and closed out. Then I couldn’t restart PMS. Tried a bunch of times. Even uninstalled and reinstalled PMS and it did the same thing.

Ended up doing a full wipe and reinstall… which i kinda had been planning for anyway due to the prior optimization issues.

@jeby6

Something else going on there.

You have to be ‘sudo’ on the machine to use DBRepair for the start/stop to work as well as preserve all the permissions (same as the shell script)

Thanks so much. The new tool works quite well with the linuxserver docker container.

I am just wondering, when you use option 11 it shows FTS not checked… when i use “3 - check” FTS is not mentioned at all (in only shos main db ok and blobs ok). Only on option “5 - repair” FTS shows up. on option 2 FTS does not show up as far as i remember. Is this desired as designed, or is it done anyway but not displayed.

Thank you for your work on this.

@LenzBond007

Thank you for spotting and reporting that!

So many little things as we get down to the nitty-gritty :slight_smile:

happy to help. I peronally am fan of more info than less info.

Keep up the great work. Cheers

Ran perfect using “auto”. No problems to fix so nothing really to report.

2026-09-17 14.51.03 - ============================================================
2026-09-17 14.51.03 - Session start. Thu Sep 17 14:51:03 2026 (ver 0.1999.10)
2026-09-17 14.51.03 - PMS Version = 1.43.4.10903
2026-09-17 14.51.03 - ============================================================
2026-09-17 14.51.03 - Load    - Matched compiled schema for PMS 1.43.4.10903
2026-09-17 14.51.03 - Load    - Loaded:   Main:  <compiled:1.43.4.10903>
2026-09-17 14.51.03 - Load    - Loaded:   Blobs: <compiled:1.43.4.10903>
2026-09-17 14.51.14 - RunSysCmd executing: 'taskkill /F /IM "PlexScriptHost.exe" > NUL 2>&1'
2026-09-17 14.51.15 - RunSysCmd: Command exited with status 0
2026-09-17 14.51.17 - RunSysCmd executing: 'net stop "PlexUpdateService" > NUL 2>&1'
2026-09-17 14.51.19 - RunSysCmd: Command exited with status 0
2026-09-17 14.51.19 - RunSysCmd executing: 'taskkill /F /IM "Plex Tuner Service.exe" > NUL 2>&1'
2026-09-17 14.51.19 - RunSysCmd: Command exited with status 0
2026-09-17 14.51.19 - RunSysCmd executing: 'taskkill /F /IM "Plex Transcoder.exe" > NUL 2>&1'
2026-09-17 14.51.20 - RunSysCmd: Command exited with status 128
2026-09-17 14.51.20 - RunSysCmd executing: 'taskkill /F /IM "Plex Media Server.exe" > NUL 2>&1'
2026-09-17 14.51.20 - RunSysCmd: Command exited with status 0
2026-09-17 14.51.21 - Stop - PASS
2026-09-17 14.51.21 - Auto    - START
2026-09-17 14.51.21 - CheckDB - Checking basic integrity - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
2026-09-17 14.51.34 - CheckDB - Checking Indexes and FTS tables - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
2026-09-17 14.51.34 - Fragment- Main DB is 0% fragmented
2026-09-17 14.51.34 - CheckDB - Full check complete - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
2026-09-17 14.51.34 - Auto - Check Main DB - PASS
2026-09-17 14.51.34 - CheckDB - Checking basic integrity - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.blobs.db
2026-09-17 14.51.43 - CheckDB - Checking Indexes and FTS tables - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.blobs.db
2026-09-17 14.51.43 - Fragment- Blobs DB is 0% fragmented
2026-09-17 14.51.43 - CheckDB - Full check complete - C:\Users\robin\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.blobs.db
2026-09-17 14.51.43 - Auto - Check Blobs DB - PASS
2026-09-17 14.51.43 - Auto    - COMPLETED - No repair needed
2026-09-17 14.51.43 - RunSysCmd executing: 'cmd /c start "" "C:\Program Files\Plex\Plex Media Server\Plex Media Server.exe"'
2026-09-17 14.51.43 - RunSysCmd: Command exited with status 0
2026-09-17 14.51.43 - Start - PASS
2026-09-17 14.51.43 - Auto    - PMS restart confirmed
2026-09-17 14.51.43 - Auto    - COMPLETED SUCCESS
2026-09-17 14.52.10 - ============================================================
2026-09-17 14.52.10 - Session end. Thu Sep 17 14:52:10 2026
2026-09-17 14.52.10 - ============================================================

Dumb question time:

If I were to stop my local PMS on Windows, temporarily move the files in the db folder to a safe backup folder, download my db files from a remote server running Debian, and with the local PMS still stopped, would DBRepair function locally or do I need to wait until I can get to my remote server to run it on that machine?

Short answer is yes

Yes it would work or yes i need to wait?

In the scenario:

  1. PMS Stopped
  2. Moved your local PMS databases elsewhere
  3. Copied your Debian databases into where your Windows DB’s were

YES, DBRepair will run.

HOWEVER, there are other options:

  1. The same identical DBRepair (Linux build) runs on Debian ( I support multiple OS’S & processors with one source code)
  2. You don’t have to swap files around.
    the --databases \path\to\databses option on the command line tells PMS to look in that directory.
    ** DBRepair will not open databases over the network (file locks)

Hello there,

Where I can download this beta verison to try it in my setup? did found any link scrolling this forum

using DBRepair.sh long ago can’t wait this new version :stuck_out_tongue:

Running: Plex with Hotio docker container
Os: UnRaid
data: big hoarder of movies and tv shows

Thanks

My database is seriously messed up and someone recommended your tool to fix it. I am “learning by doing” on both running a server and using Linux, so please forgive what I suspect is a pretty dumb question: what are the risks of beta testing this? Is there anything that could go wrong that someone with little technical background (but who is fairly good at following directions) could not easily repair?

@ChuckPa

The expunge command, does it now check for deleted users from my own server and deletes their watch history?

Let’s say I once had 5 users, but I removed access for 2 of them. Will it erase the watch history for those 2 users that I removed?

@d2freak

If the user is removed from the accounts table then yes

From my earlier interaction with chuckpa specifically about this, only if they also no longer have a Plex account. It’s trickier to do that with just disconnected users but they said they’d keep it in mind for the future.

@dane22 - is “has Plex account” what the accounts table would represent?

I honestly didn’t mind the stale data nor for removing disconnected users before because I never saw it, but the new Plex apps show you all users no matter if they are still connected to your server or not. If they just changed that view (or made a toggle) then personally that’d be a solve for my specific issue. I don’t care about the small chunk of data existing for historical reference, I just don’t wanna have to weed through inactive users when trying to view my current users’ activity. :slight_smile:

When a user has been granted access to your server, he/she is created in the accounts table

Just not sure if they stay there forever, og get’s removed if rights are rewoked, thus why I did ask @d2freak to test, since I’ve not had any users revoked on my system