How to manually edit the database

Hello
For the last couple of weeks any movies within my “Movies” folder under the “S” (when i browse by alphabetical order) I always get an error message “nothing to see here”. I never used to have this problem before and the movies used to play fine before. Now I can’t scroll down to the letter S without getting an error message. Every other “letter” displays all the movies perfectly except the letter S.

I contacted support and have done the “Plex Dance” (removing all the movies that begin with “S” then “empty trash” then “update library” and place the movies back in) I have also tried deleting the library itself as suggested by support but I also get an error message stating “there was an error trying to delete this library”. So basically it doesn’t let me delete that library either.

The support person suggested i ask how to manually edit the database here in this forum to remove the bad entries from all the movies that begin with the letter S.
Any help would be greatly appreciated.

Hello. The Plex database is based on SQL and uses SQLite. Are you familiar with SQL?

Also, what OS are you running PMS on?

Im not familiar with SQL honestly. My 2008 Mac Pro (being used only as a server) is running OS X 10.11 Yosemite (the latest version)

The easiest way would then be for you to PM me your database. From PlexWeb, Settings \ Server \ Help \ Download Database. This will give you a zip file. Send that to me. I’ll find the bad entry and send it back to you. You then need to shut down PMX, manually unzip the file and replace the original database file, then restart PMS.

2 Likes

@MovieFan.Plex said:
The easiest way would then be for you to PM me your database. From PlexWeb, Settings \ Server \ Help \ Download Database. This will give you a zip file. Send that to me. I’ll find the bad entry and send it back to you. You then need to shut down PMX, manually unzip the file and replace the original database file, then restart PMS.

That’s really gracious of you to do that for him … :#

@MovieFan.Plex said:
The easiest way would then be for you to PM me your database. From PlexWeb, Settings \ Server \ Help \ Download Database. This will give you a zip file. Send that to me. I’ll find the bad entry and send it back to you. You then need to shut down PMX, manually unzip the file and replace the original database file, then restart PMS.

I really appreciate that, but I would like to give it a try myself to find the bad entries and fix them in case it ever happens again in the future. Im a studio engineer so I’m pretty tech savvy and would like to learn how to do this if possible. Now that I know where to grab the file from, is there something I should be looking for in particular and when I do find it how do I correct the entry?

@MovieFan.Plex said:
The easiest way would then be for you to PM me your database. From PlexWeb, Settings \ Server \ Help \ Download Database. This will give you a zip file. Send that to me. I’ll find the bad entry and send it back to you. You then need to shut down PMX, manually unzip the file and replace the original database file, then restart PMS.

Just an update I downloaded the Plex database zip file and NOTHING can open it. I tried the archive utility on Mac which just creates a .cpgz file then creates another zip file. I also tried Bandizip and StuffIt Expander and neither can open the zip file. Any suggestions?

First, you don’t want to use that zip file. You need to find the original. It should be in

~/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db

Make a backup in case you make a mistake. Then you need SQLite to be able to read the file. MacOS comes with SQLite pre-loaded but there is no UI so I wouldn’t suggest using it. For beginners, I would suggest installing FireFox then the SQLite plug-in. This allows you to view your data visually. Try this and browse around a bit. I’ll provide the steps for finding the correct entry a little later after I’ve confirmed the steps.

1 Like

Ok great ill keep a look out for when you update this thread

Thanks for the bump, I knew I was forgetting something.

Basically, you want to browse the table metadata_items. Look through the date fields, sort them ascending or descending (your choice) and look for things that do’t look like dates. The main fields that cause issues are originally_available_at and added_at.

If you find any, either put in a valid date or delete the entire row. On your next library scan, that item will be found again and the entry in the database rebuilt with correct info. If the problem comes back, it could be that it is retrieving bad data from the agent.

1 Like