Server Version#: 1.25.4.5487
Player Version#: Web Version 4.69.1
So I’ve left this issue run for several months (I think it started in ~July 2021) since it wasn’t blocking me from watching things, but it’s finally reached the point where it’s annoying enough for me to troubleshoot 
Symptoms:
- Lost a few movie collections, some partially some completely (movie files still exist)
- When I finish watching a movie or episode of TV, it does not get marked as ‘watched’. It stays at ~95% watched.
- Can’t manually mark TV episodes, seasons, shows, or Movies as ‘watched’
Having a peek at the logs, it looks like there is a DB corruption issue, which makes sense. In the Plex Settings > Scheduled Tasks I have the box ticked to backup the database every 3 days. When I go to the ‘Backup directory’ it looks like the last com.plexapp.plugins.library.db backup was made on 2021-05-13. The last com.plexapp.plugins.library.blobs.db backup was 2022-02-01 (and there are three more going back to 2022-01-23).
[/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Plug-in Support/Databases] # ls -ltr
total 9238896
-rw-r--r-- 1 admin administrators 8024064 2019-12-22 23:46 com.plexapp.plugins.trakttv.db
-rw-r--r-- 1 admin administrators 32768 2019-12-23 09:25 com.plexapp.plugins.trakttv.db-shm
-rw-r--r-- 1 admin administrators 4157112 2019-12-23 09:25 com.plexapp.plugins.trakttv.db-wal
-rw-r--r-- 1 admin administrators 760367104 2021-05-04 02:01 com.plexapp.plugins.library.db-2021-05-04
-rw-r--r-- 1 admin administrators 760367104 2021-05-07 02:00 com.plexapp.plugins.library.db-2021-05-07
-rw-r--r-- 1 admin administrators 754630656 2021-05-10 02:00 com.plexapp.plugins.library.db-2021-05-10
-rw-r--r-- 1 admin administrators 754765824 2021-05-13 02:00 com.plexapp.plugins.library.db-2021-05-13
-rw-r--r-- 1 admin administrators 1089975296 2022-01-23 02:04 com.plexapp.plugins.library.blobs.db-2022-01-23
-rw-r--r-- 1 admin administrators 1090806784 2022-01-26 02:03 com.plexapp.plugins.library.blobs.db-2022-01-26
-rw-r--r-- 1 admin administrators 1090965504 2022-01-29 02:03 com.plexapp.plugins.library.blobs.db-2022-01-29
-rw-r--r-- 1 admin administrators 1125001216 2022-02-01 02:05 com.plexapp.plugins.library.blobs.db-2022-02-01
drwxr-xr-x 2 admin administrators 4096 2022-02-01 02:10 Music Analysis 3/
-rw-r--r-- 1 admin administrators 1125062656 2022-02-01 18:41 com.plexapp.plugins.library.blobs.db
-rw-r--r-- 1 admin administrators 0 2022-02-01 19:53 com.plexapp.plugins.library.blobs.db-wal
-rw-r--r-- 1 admin administrators 32768 2022-02-01 20:29 com.plexapp.plugins.library.blobs.db-shm
-rw-r--r-- 1 admin administrators 2150400 2022-02-01 20:29 com.plexapp.dlna.db
-rw-r--r-- 1 admin administrators 32768 2022-02-01 20:29 com.plexapp.dlna.db-shm
-rw-r--r-- 1 admin administrators 2385512 2022-02-01 20:29 com.plexapp.dlna.db-wal
-rw-r--r-- 1 admin administrators 890702848 2022-02-01 20:37 com.plexapp.plugins.library.db
-rw-r--r-- 1 admin administrators 1056416 2022-02-01 20:50 com.plexapp.plugins.library.db-wal
-rw-r--r-- 1 admin administrators 32768 2022-02-01 20:50 com.plexapp.plugins.library.db-shm
I followed this process to run the auto check and repairs on the db, but the check returned ‘OK’ pretty much immediately and the manual repair tool finished and produced a 55b ‘dump.sql’ file pretty much immediately as well.
I tried restoring the DB by following this process, but when I started Plex back up it wouldn’t load in my browser and I was getting some ‘corrupt database’ errors in the logs. I tried all of my backup .db files but they all had the same result.
[/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Logs] # cat "Plex Media Server.3.log2:
>
[/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Logs] # cat "Plex Media Server.3.log"
Feb 01, 2022 19:51:47.651 [0x7fc5782a1b38] INFO - Plex Media Server v1.25.4.5468-989df2310 - QNAP TVS-1282 x86_64 - build: linux-x86_64 qnap - GMT 11:00
Feb 01, 2022 19:51:47.651 [0x7fc5782a1b38] INFO - Linux version: QTS 5.0.0.1891, language: en-US
Feb 01, 2022 19:51:47.651 [0x7fc5782a1b38] INFO - Processor Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Feb 01, 2022 19:51:47.651 [0x7fc5782a1b38] INFO - Compiler is - Clang 11.0.1 (https://plex.tv b587490162c22e078c314e3f7dc560c691d126aa)
Feb 01, 2022 19:51:47.651 [0x7fc5782a1b38] INFO - ./Plex Media Server
Feb 01, 2022 19:51:47.653 [0x7fc57b93fb58] ERROR - SQLITE3:0x80000001, 11, database corruption at line 68176 of [1b256d97b5]
Feb 01, 2022 19:51:47.653 [0x7fc57b93fb58] ERROR - SQLITE3:0x80000001, 11, database disk image is malformed in "PRAGMA cache_size=2000"
Feb 01, 2022 19:51:47.653 [0x7fc57b93fb58] ERROR - Database corruption: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000
Feb 01, 2022 19:51:47.653 [0x7fc57b93fb58] ERROR - Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)
Losing my watched history isn’t that big of a deal, but I had invested a good chunk of time building some kickass Movie collections and Playlists, and it’d be pretty devastating to have to start over on them.
I’ve attached some logs from when Plex starts up with the ‘usable’ corrupt database. Does anyone have any ideas on how to repair this DB or any of the DB backup files?
plex.log (13.3 KB)







