Server Version#: V 1.40.0.7998 (About to update to newest)
I get notices on my phone that the server database is corrupt So I have a question or 2 about that.
If it’s corrupt how does everything still work as it should? All movies and tv shows appear (at least) to be fine. I have almost 5000 movies and over 34,000 tv episodes. And a random sampling seems to show they are ok.
If the db is in fact corrupted is it possible to FIX without losing everything I have spent months fixing (Lost several hd’s - almost 10TB) a few months ago and most of that was media files. I have since obtained them all again but spend many hours a week setting up Posters, Collections, Labels, as well as other info in Plex.
I have spent some time looking at posts on other sites about how to repair the db and none of them have worked for me. (Windows 11 - newest stable version) And for that matter, which DB file is the one corrupted? …library.db, …blobs.db, …library.db-wal, etc…
Can I delete the corrupted db (whichever one it is) and still keep all my edits, mods, and changes?? That’s, honestly, all I care about… I am sick and tired of redoing all this work as this last time was my 5th time doing it since Plex started.
Is there an app for the PC that will let me read the db’s? Find errors?
Odd that it’s corrupt but yet still works and saves a backup every 3 days…
Download the Windows ZIP file, unzip, and run from the command line (stop Plex Media Server before running).
Download link. Click on the downward arrow on the far right to download.
If the repair does not work, you can try loading a backup version of the database. See Restore a Database Backed Up via ‘Scheduled Tasks’.. Note that the backup may also be corrupt, so you should run the DBRepair Utility after loading the backup on the server.
Sample output:
c:\Temp\DBRepair-Windows>DBRepair-Windows.bat
13:15:43.10 -- ====== Session begins. (Mon 04/29/2024) ======
13:15:43.32 -- Exporting Main DB
13:15:43.74 -- Exporting Blobs DB
13:15:43.79 -- Exporting Complete.
13:15:43.80 -- Creating Main DB
13:15:43.88 -- Verifying Main DB
13:15:44.03 -- Main DB verification check is: ok
13:15:44.03 -- Main DB verification successful.
13:15:44.03 -- Creating Blobs DB
13:15:44.09 -- Verifying Blobs DB
13:15:44.12 -- Blobs DB verification check is: ok
13:15:44.12 -- Blobs DB verification successful.
13:15:44.13 -- Import and verification complete.
13:15:44.13 -- Reindexing Main DB
13:15:44.18 -- Reindexing Blobs DB
13:15:44.22 -- Reindexing complete.
13:15:44.22 -- 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.
13:15:44.24 -- Database repair/rebuild/reindex completed.
13:15:44.24 -- ====== Session completed. ======
Thank you so much!!! I used it and it said everything was OK…so I have no clue why PLEX messages me that the db is corrupt. Unless it always says verification OK but fixes stuff anyway.
Thanks again. GREAT TOOL!!! I’ll keep up with the progress of it.
Greg
NOTE: I wrote that before I opened PLEX. Plex says it can’t open the DB. DOH!!! Won’t even open the backup it made from earlier this morning. Well, this blows…
I have tried to reload the old blobs and library db’s. It still says unable to open media database. Hmmm… May have to retract my praise of the app…everything worked until I used it…even though I get the corrupt messages on my phone. It always launched and worked for everyone using it…
Not entirely sure what I did…well, I know exactly what I did…but it works now. Not sure if still corrupted or not.
I copied the library and blob db files from the dbtmp folder and renamed them after deleting everything in the database folder. Launched PLEX and it created all the files again and seems to be running fine now…
If the messages return, you can check the log files for errors.
Pull the server log files (settings → troubleshooting) and unzip.
Look in Plex Media Server.log (and .1.log to .5.log) for ERROR messages with corruption or malformed (they will also have SQLITE3/sqlite3).
The DBRepair Utility should clean up those problems. If it does not, upload the log files and we can see if something else is happening (just drag the ZIP file into the message window, it will insert at the cursor location).
Example log entries showing database corruption:
Jul 05, 2020 19:36:56.959 [0x7f59f1b85740] ERROR - SQLITE3:(nil), 11, database corruption at line 64817 of [bf8c1b2b7a]
Jul 05, 2020 19:36:56.959 [0x7f59f1b85740] ERROR - SQLITE3:(nil), 11, statement aborts at 10: [select max(max(metadata_items.changed_at),max(metadata_items.resources_changed_at)) from metadata_items] database disk image is malformed
Jul 05, 2020 19:36:56.978 [0x7f59f1b85740] ERROR - Database corruption: sqlite3_statement_backend::loadOne: database disk image is malformed