Unable to open media database after upgrade to 17134

Server Version#: 1.18.2.2058
OS: Windows 10
Player Version#: N/A

Hello all - I’ve been stuck on an older version (1.16.3.1402) for some time because every time I try to upgrade to a new version I get database corruption errors. For the most part, my database in the older version works without issue, but it corrupts itself 100% of the time when I try to upgrade.

I’ve tried the instructions to repair a corrupt database, and no issues are found. The errors from my plex media server log after upgrading and failing to start are:

Dec 07, 2019 21:53:37.873 [11600] INFO - Plex Media Server v1.18.2.2058-e67a4e892 - Microsoft PC x64 - build: windows-x86 windows - GMT -07:00
Dec 07, 2019 21:53:37.874 [11600] INFO - Windows version: 10.0 (Build 17134), language en-US
Dec 07, 2019 21:53:37.874 [11600] INFO - 16 2000 MHz processor(s): Architecture=0, Level=6, Revision=15876 Processor Identifier=Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
Dec 07, 2019 21:53:38.078 [2680] ERROR - SQLITE3:0xa36ef04f, 1, duplicate column name: data in “ALTER TABLE ‘media_provider_resources’ ADD ‘data’ blob”
Dec 07, 2019 21:53:38.079 [2680] ERROR - Exception inside transaction (inside=1) (…\Library\DatabaseMigrations.cpp:209): sqlite3_statement_backend::prepare: duplicate column name: data for SQL: ALTER TABLE ‘media_provider_resources’ ADD ‘data’ blob
Dec 07, 2019 21:53:38.085 [2680] ERROR - Exception thrown during migrations, aborting: sqlite3_statement_backend::prepare: duplicate column name: data for SQL: ALTER TABLE ‘media_provider_resources’ ADD ‘data’ blob
Dec 07, 2019 21:53:38.359 [2680] ERROR - SQLITE3:0xa36ef04f, 1, no such column: library_sections.content_changed_at in “select max(max(library_sections.changed_at),max(library_sections.content_changed_at)) from library_sections”
Dec 07, 2019 21:53:38.360 [2680] ERROR - Database corruption: sqlite3_statement_backend::prepare: no such column: library_sections.content_changed_at for SQL: select max(max(library_sections.changed_at),max(library_sections.content_changed_at)) from library_sections

In the distant past I’ve had to mess with manually updating things in my DB to fix corruption, so I am capable of doing that, but need a pointer please on where to look for this corruption or how to fix the duplicate column error above so that the migration to the new version can be successful.

Help would be much appreciated! Thank you.

Quick bump here to see if I can get an assist from someone who understands the Plex DB structure please. Thank you.

Well… after mucking about with the sql database for a bit I was able to solve this problem myself. For anyone else who needs help in the future, two points.

  1. The duplicate column errors don’t seem to actually be an error, it’s just reporting that it won’t add the column because it already exists.

  2. The missing column had to be fixed manually using sqlite. Here are the commands I used to do so:

sqlite> .open com.plexapp.plugins.library.db
sqlite> ALTER TABLE library_sections ADD content_changed_at datetime
sqlite> PRAGMA table_info(library_sections);  
sqlite> .quit

(the PRAGMA command verifies that the new column has been added as you intended).

After that, the DB opens as intended. Hopefully no more issues from here.

1 Like

I continued to have problems with further Plex upgrades after this fix and wanted to document the additional work I had to do with the database to eventually upgrade to 1.18.4.2171.

When upgrading to that version, I received the following error in the logs:

Jan 12, 2020 15:32:27.933 [47532] ERROR - SQLITE3:0xed7736dc, 1, no such column: metadata_item_settings.last_rated_at in "select media_items.id as 'media_items_id', media_items.library_section_id as 'media_items_library_section_id', media_items.section_location_id as 'media

This was fixed in a similar fashion to the last post:

sqlite> .open com.plexapp.plugins.library.db
sqlite> ALTER TABLE metadata_item_settings ADD last_rated_at datetime
sqlite> PRAGMA table_info(metadata_item_settings);  
sqlite> .quit

After this, to my GREAT relief, Plex opened as expected again.

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