DBRepair development

ALL:

( @nibbles and those who help test )

I have minor update v1.0.8 in a test branch (require-root) and would appreciate kicking the tires to make sure I didn’t break anything.

The purpose of this little change is to ensure the tool isn’t invoked as a non-privileged UID (Primarily on QNAP and Synology NAS systems) where it’s possible for a user to create a DB which cannot be accessed by PMS once put back into operational position.

(Shared folder permissions allowed them to run the tool but lack of Linux permissions prevented the correct UID/GID & mode from being assigned when done)

It’s better to be safe upfront than deal with the mess later.

Please inspect my error messaging (lines 940-ish) and let me know if they make sense.

Also, please let me know if you can bypass the root-requirement (you shouldn’t be able to)

Version 1.08 works fine on my DS918+/DSM 7.1.1 Update 5, PMS 1.32.2.7100.

It would not run under my normal username. I had to be root (sudo bash).

# ./DBRepair stop auto start quit executed correctly and left the temporary files.
# ./DBRepair stop auto start exit executed correctly and removed the temporary files.

1 Like

@FordGuy61

Was the error message informative with username included ?

Yes. I should have included it.

ERROR:  Tool running as username 'L0neWo1f'.  'Synology (DSM 7)' requires 'root' user privilege.
        (e.g 'sudo -su root' or 'sudo bash')
        Exiting.
1 Like

Thanks Chuck!

Where would I put the files on Windows before I run the bat? Next to the db?

Working as intended on Ventura, Great Job :saluting_face:

@ChuckPa

Thanks for the tool. It worked fine and I definitely see a big speed increase. My music library with almost 200k songs was getting a bit slow to search in. Now it’s instant!

A question though. This is more for my curiosity. The main DB did go down a bit in size, as expected. However, the blobs DB actually increased slightly in size. Why’s that?

I shouldn’t be concerned that something went wrong right? This was on Windows and the logs said everything was fine.

I’ve never understood that entirely myself.

I suspect , based on my investigating, my generating full indexes for the tables is the cause.

It’s not much at all but is measurable.

That might also be one of the reasons DB searches have become so much faster

If you didn’t get any errors reported then you’re good.

1 Like

I believe I’m in need of using the PlexDBRepair on my Windows Server 2016 Plex installation. It’s running quite sluggishly and no other optimization seems to be working to help speed things up enough.

This is a long thread to read through so I’m hoping someone can give me the steps as to how to go about running PlexDBPlex safely on Windows and making sure I have a backup and restore option in place.

Thanks.

@Kilgry

Ask and ye shall receive: :sunglasses:

There is a preset sequence BAT file for Windows.

Okay, having some trouble.

It isn’t finding the SQlite db. The BAT file is looking in “Program Files” but it is in “Program Files (x86)”.

I believe I setup everything with defaults.

Is there a Plex 32-bit and Plex 64-bit versions? Do I need to be running the 64-bit?

I’m running Version 1.32.4.7195 but not sure if 64-bit or 32-bit or if there is even such an option.

Should I just change the BAT line:
set “PlexSQL=%PROGRAMFILES%\Plex\Plex Media Server\Plex SQLite”

to be

set “PlexSQL=%PROGRAMFILES(x86)%\Plex\Plex Media Server\Plex SQLite”

PMS should be 64 bit ?? (what I wrote it for so it supports hardware transcoding)

If you’re not using that / have a customized installation, feel free to edit it.

the Windows BAT file is very basic because I don’t have/know windows well.
(Win 95 was a LONG time ago)

I think it has IF THEN blocks but I don’t remember them
Also, it should have ‘%ERRORLEVEL%’ ??

If I can make the bat smarter, I will. I only need some guidance.

As for “How long does it take?”
– Size of the DB
– Speed of the processor
– Speed of the I/O

The first CheckDB operation takes the longest (reading into RAM and checking).
After that, things are cached by the OS.

The %ERRORLEVEL% did catch the issue and stopped the batch.

I’ll make the change to the BAT file and see how it goes.

Yes, I thought Plex was 64-bit too. Not sure why the Plex SQLite got installed into the “Program Files (x86)” folder if 64-bit. It’s been so long since I installed Plex I don’t recall if there was an option to specify the SQLite folder, nor do I think I would have changed it. No biggie, if the simple BAT file change does the trick.

I’ll need to try running the dbrepair later; active streams are picking up for the day.

@Kilgry

I don’t follow Windows very closely.

I think I heard that 32 bit Windows installations were upgrading to 64 bit in the installer.
I don’t know how that works at all .

If you can make things work by the simple edit then please do use it.

A user is creating a powershell (?) version.
It will be nice to have that as an option for folks when the work is completed.

Hmm, it appears the 32-bit version of the server is still being offered for download:
Media Server Downloads | Plex Media Server for Windows, Mac, Linux, FreeBSD and More

So, now I probably should figure out what version I’m running. Not quite sure how to do that, but it looks like I might have installed the 32-bit version based on the directory structure.

Anyone know how to determine what bit version I am running?
Never mind, found out it is the 32-bit:
image

Has PlexDBRepair been run against the 32-bit version?

I found these instructions from moving from 32-bit to 64-bit:
How to Move from 32-bit to 64-bit Plex for Windows - Plexopedia

Found this too:
Preview: Plex Media Server for Windows 64-bit version - Plex Media Server / Desktops & Laptops - Plex Forum

Okay, I decided to go ahead and run the PlexDBRepair against the 32-bit version and it appears to have been successful. Was pretty quick too at about 10 minutes on a fairly large set of media.

I just had to make the BAT file change %PROGRAMFILES(x86)%.

One question:
I have lost about 8GB of drive space. Does the PlexDBRepair clean up all the DB exports it creates?

Notice the “Moving current…” line.
Look in DBTMP in the database folder.

Thank you.

So, I assume the files in the DBTMP are safe to delete once it is confirmed Plex is running fine?

Correct.