User Tools

Site Tools


plex_information

Plex Media Server (PMS) Information


Repairing the Database when running PMS in a Docker Container

The following was posted to Reddit and is preserved here “just in case”

This needs a lot of updating/cleanup but it is a starting point.

I spent a long time trying to find the answer to this. It looks like they finally updated the instructions, but they're still not non-windows friendly.

You have to do it from within the container, but you have to stop the service in order to do the repair. In Unraid under Dockers, click on the Plex container you want to repair and open the console for it.

To stop the service (and not the whole container) type

./plex_service.sh -d

If you're on the new linuxserver container, use the following

cd /var/run/s6/services
s6-svc -d plex

This will leave the container running without Plex running as well.

Now, everything with the repair instructions is basically the same, just your paths are different. The path inside my docker container is set to /config so my full path to the Plex databases within the container console is

cd "/config/Library/Application Support/Plex Media Server/Plug-in Support/Databases/"

After that you'll do the first step, making a backup, as normal.

cp com.plexapp.plugins.library.db com.plexapp.plugins.library.db.bak

From there you will use the full path to your executable. This will be the same, regardless of where your config path is. Copy/Paste each line. (As I type this it looks like each one is 2 lines, but it may just be wrapping for the small window.)

Error check

“/usr/lib/plexmediaserver/Plex Media Server” –sqlite com.plexapp.plugins.library.db “DROP index 'index_title_sort_naturalsort'”

“/usr/lib/plexmediaserver/Plex Media Server” –sqlite com.plexapp.plugins.library.db “DELETE from schema_migrations where version='20180501000000'”

"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db "PRAGMA integrity_check"

And to repair, the following

“/usr/lib/plexmediaserver/Plex Media Server” –sqlite com.plexapp.plugins.library.db “DROP index 'index_title_sort_naturalsort'”

“/usr/lib/plexmediaserver/Plex Media Server” –sqlite com.plexapp.plugins.library.db “DELETE from schema_migrations where version='20180501000000'”

"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db .dump > dump.sql
rm com.plexapp.plugins.library.db
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db < dump.sql
chown plex:plex com.plexapp.plugins.library.db

Edit: crossed off old, unused commands and added the linuxserver.io stop command

plex_information.txt · Last modified: by mike

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki