Server Version#: 1.41.7.9823
Player Version#: Plex Web 4.146.0
OS: Ubuntu 24.04.2
Apparently my Plex server has been failing to backup for months and I didn’t know. Turns out its because my database is corrupt, likely due to some system lockup/kernel panic type crashes on my OS where I have to hard-power-off the system to get it back online. I have tried running through the official Repair a Corrupted Database | Plex Support guide, but whenever I run the PRAGMA integrity_check; command, it errors with the “Database disk image is malformed” error, and VACUUM; and REINDEX; don’t seem to have any effect either.
I’ve also tried the low-level recovery option, but the resulting db-recover.sqlite file winds up being about 85GB, and when reimported into a new DB file, the new DB is 16GB in size when the original DB file was 7GB, and EVEN THEN, if I run a PRAGMA integrity_check; on the NEW database file, I still get a Database disk image is malformed error.
I’ve also tried @ChuckPa’s DBRepair.sh script, and even that isn’t working properly either and errors with the following:
Automatic Check,Repair,Index started.
Checking the PMS databases
Check complete. PMS main database is damaged.
Check complete. PMS blobs database is OK.
Exporting current databases using timestamp: 2025-05-26_00.43.18
Exporting Main DB
Exporting Blobs DB
Successfully exported the main and blobs databases.
Start importing into new databases.
Importing Main DB.
Parse error near line 21470035: near "MNTO": syntax error
INSERT MNTO statistics_bandwidth VALUES(27672728,NULL,1345,1,1746075600,0,6553
^--- error here
Parse error near line 21470041: no such table: statistics_bandsidth
Runtime error near line 55932556: UNIQUE constraint failed: statistics_bandwidth.id (19)
Runtime error near line 55932621: UNIQUE constraint failed: statistics_bandwidth.id (19)
Parse error near line 63503718: no such column: NULD
INSERT INTO statistics_bandwidth VALUES(79812472,NULD,1345,1,1746075600,0,822)
error here ---^
Error 1 from Plex SQLite while importing from './dbtmp/library.plexapp.sql-2025-05-26_00.43.18'
Cannot continue.
Repair failed. Automatic mode cannot continue. Please repair with individual commands
Anyone have any thoughts or ideas? I’d like to get this actually repaired so that Plex backups are working properly without having to completely rebuild my server, or rely on dirty snapshot type backups from something like Veeam.