Database is corrupt or Maintenance?

Server Version: PlexMediaServer-1.40.4.8679-424562606-x86_64

After latest update, I can’t run plex on my Windows server. When I attempt to run the plex server exe, I get a popup

---------------------------
Corrupt database
---------------------------
Plex Media Server was unable to open its media database.
---------------------------
OK   
---------------------------

If I click OK, the app immediately shuts down (no longer in system tray/ process explorer).

I followed the instructions at https://support.plex.tv/articles/repair-a-corrupted-database/ and validated that the sqlite db reports no error in AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db

I did notice that if I don’t hit the OK on the popup; and try to navigate to my plex instance I get the following error:

<Response code="503" title="Maintenance" status="Plex Media Server is currently running database migrations."/>

So here’s my questions; is the database actually corrupt, or is it doing some some or maintenance thing? I can’t believe its actually doing maintenance as the app stops as soon as I click the OK button on the popup.

If it is corrupt, and I can’t get it back using the sqllite commands as documented in the article; and given that I don’t have a backup, I guess I need to blow it away and rebuilt it all? How do I do that? Its thousands and thousands of titles, so I’m not too excited about about having to rebuild it, but less excited about not having a running plex server.

Database Repair

Download and run the PlexDBRepair.bat file for Windows.

It does a more thorough job when attempting a database repair.

If it cannot fix the database, then you can try to use a backup version. See Restore a Database Backed Up via ‘Scheduled Tasks’.

Note 1: The backup database might also be corrupt, so you should run the DB Repair bat file for it as well.

Note 2: There is also a powershell version that performs the same function and will eventually replace the bat file. See the README and Release Notes at PlexDBRepair/Windows at master · ChuckPa/PlexDBRepair · GitHub.

503 Maintenance

It is common for new Plex releases to have a different database schema. The message appears while Plex is converting the database to the new format (or to a prior format if installing an older version). It may also appear after repairing a database.

You should wait for the migration to finish. The message will not auto-update. Refresh the browser window every few minutes. Depending on the size of the database, the speed of your CPU, and the number of changes, it can take minutes to hours to complete. However, after a repair, the message should appear for only a few minutes (i.e. 5, not 50).


Plex DBRepair

Download the bat file: PlexDBRepair/Windows/DBRepair-Windows.bat at master · ChuckPa/PlexDBRepair · GitHub

Click on the download button:


Run from a c:\ prompt:

C:\Temp\DBRepair-Windows>DBRepair-Windows.bat
23:24:22.55 --  ====== Session begins. (Wed 07/17/2024) ======
23:24:22.78 --  Exporting Main DB
23:24:23.19 --  Exporting Blobs DB
23:24:23.35 --  Exporting Complete.
23:24:23.35 --  Creating Main DB
23:24:23.44 --  Verifying Main DB
23:24:23.49 --  Main DB verification check is: ok
23:24:23.49 --  Main DB verification successful.
23:24:23.50 --  Creating Blobs DB
23:24:23.56 --  Verifying Blobs DB
23:24:23.60 --  Blobs DB verification check is: ok
23:24:23.60 --  Blobs DB verification successful.
23:24:23.61 --  Import and verification complete.
23:24:23.62 --  Reindexing Main DB
23:24:23.67 --  Reindexing Blobs DB
23:24:23.83 --  Reindexing complete.
23:24:23.83 --  Moving current DBs to DBTMP and making new databases active
        1 file(s) moved.
        1 file(s) moved.
        1 file(s) moved.
        1 file(s) moved.
23:24:23.85 --  Database repair/rebuild/reindex completed.
23:24:23.85 --  ====== Session completed. ======

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.