Database corruption / Refuses to boot up / What now?

Server Version#: Latest
Player Version#: Browser / Plexamp

My MacMini restarted and when I tried to launch the server app it wouldn’t boot. I looked for solutions online and found the official article on “repairing databases” but it didn’t work. Now I’m lost :confused: Here are my logs. Thank you!

Sep 21, 2018 05:23:39.552 [0x70000158e000] INFO - Plex Media Server v1.13.5.5332-21ab172de - Apple Mac  - build: darwin-x86_64 macosx - GMT -07:00
Sep 21, 2018 05:23:39.553 [0x70000158e000] INFO - MacOSX version: 10.13.6, language: en-US
Sep 21, 2018 05:23:39.553 [0x70000158e000] INFO - Processor Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Sep 21, 2018 05:23:39.553 [0x70000158e000] INFO - /Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server
Sep 21, 2018 05:23:39.781 [0x7000018a0000] DEBUG - BPQ: [Idle] -> [Starting]
Sep 21, 2018 05:23:39.812 [0x7000018a0000] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.13.0, threadsafe=1
Sep 21, 2018 05:23:40.061 [0x7000018a0000] INFO - SQLITE3:0x70000189f590, 283, recovered 293 frames from WAL file /Users/blahblah/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal
Sep 21, 2018 05:23:40.421 [0x7000018a0000] DEBUG - Running migrations.
Sep 21, 2018 05:23:41.104 [0x7000018a0000] ERROR - SQLITE3:0x70000189f590, 11, database corruption at line 59437 of [fc49f556e4]
Sep 21, 2018 05:23:41.104 [0x7000018a0000] ERROR - SQLITE3:0x70000189f590, 11, database corruption at line 59479 of [fc49f556e4]
Sep 21, 2018 05:23:41.104 [0x7000018a0000] ERROR - SQLITE3:0x70000189f590, 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
Sep 21, 2018 05:23:41.132 [0x7000018a0000] ERROR - Database corruption: sqlite3_statement_backend::loadOne: database disk image is malformed
Sep 21, 2018 05:23:41.133 [0x7000018a0000] ERROR - Error: Unable to set up server: sqlite3_statement_backend::loadOne: database disk image is malformed (N4soci10soci_errorE)

Sep 21, 2018 05:34:46.789 [0x70000e5f4000] INFO - Plex Media Server v1.13.5.5332-21ab172de - Apple Mac  - build: darwin-x86_64 macosx - GMT -07:00
Sep 21, 2018 05:34:46.790 [0x70000e5f4000] INFO - MacOSX version: 10.13.6, language: en-US
Sep 21, 2018 05:34:46.790 [0x70000e5f4000] INFO - Processor Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Sep 21, 2018 05:34:46.790 [0x70000e5f4000] INFO - /Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server
Sep 21, 2018 05:34:47.096 [0x70000e906000] DEBUG - BPQ: [Idle] -> [Starting]
Sep 21, 2018 05:34:47.103 [0x70000e906000] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.13.0, threadsafe=1
Sep 21, 2018 05:34:47.143 [0x70000e906000] DEBUG - Running migrations.
Sep 21, 2018 05:34:47.143 [0x70000e906000] ERROR - SQLITE3:0x70000e905590, 1, no such table: schema_migrations
Sep 21, 2018 05:34:47.184 [0x70000e906000] ERROR - Database corruption: sqlite3_statement_backend::prepare: no such table: schema_migrations for SQL: select version from schema_migrations order by version

all good! restored a backup.

Even the backup version might already have corruption growing inside.
I’d invest the time to perform the repair procedure.

https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

Ok I ran the first 4 steps to “check” and no errors.

Then when going through the 6 steps to repair, on the 2nd step I had

Server:Databases username$ sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"
Error: no such index: index_title_sort_naturalsort

everything else seems fine. any idea why?

thanks

Normally, this means the database file you have is from a very old server version.
How did you grab the databasse file?
Did you copy it directly from the Plex data folder or did you download it with the Plex web app?

If the latter, you might need to omit this step.

Yes, I’ve been using Plex for a couple of years and every time I’ve moved computers, I would copy everything over directly from the source folders, according to the Plex instructions. So, you may be right. I had no idea there was an app for database migration.

Edit: https://support.plex.tv/articles/201370363-move-an-install-to-another-system/
this is what I used and it seems its still current.

There is no app for database migration.
What gives you the idea?

I must have misunderstood you when you asked if i downloaded the database “with the Plex web app”

Under Settings - Troubleshooting you can download server logs and the database.
But this is mainly for diagnosing bugs, not for migrating from one server to another. A full migration requires much more data copied over, not just the relatively tiny database.

But that is just an aside.
So, back to the topic:
The database file you were using is one you restored from an external backup, or is it the currently used main database file of your server?

I see. Good to know.

Yes, the database I was using prior to the crash was from an external back up I created when I migrated, now it’s a restored database from a backup that the server created automatically that was sitting in the folder next to the damaged database.

Sorry, I should have expressed myself clearer.

  1. The file on which you tried the repair procedure: was it already present in the folder for at least one startup of your current Plex server version?
  2. Or did you copy it fresh from a backup and tried the repair procedure immediately, without starting Plex server before?

First option

Ugh. I just re-read the instructions.
You must omit steps 2 and 3 from the repair procedure, because you already performed them during the check.

I will file a request for clarifiying the documentation.

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