My Plex server on Unraid went down hard this week. No warning, no gradual degradation — just stopped working. After a few restarts produced the same result, I dug into the logs and found this:
Starting Plex Media Server. Error: Unable to set up server: std::exception (N2DB9ExceptionE) Stopping Plex Media Server
Classic corrupted database. Here’s how I fixed it, what I tried first, and why a simple backup restore ended up being the answer.
Screenshot of terminal showing “PRAGMA integrity_check” returning “ok” after restoring the Plex database backup on Unraid
The official Plex documentation isn’t great for Docker setups on Unraid. The repair process requires SQLite — which is bundled with Plex — but you need Plex stopped while running the commands. That means using the container’s console rather than running things from the Unraid terminal.
In Unraid, go to Docker, click the Plex container icon, and open the console.
For the older plexinc/pms-docker container:
./plex_service.sh -d
For the newer lscr.io/linuxserver/plex container:
cd /var/run/s6-rc/servicedirs/ s6-svc -d svc-plex
cd "/config/Library/Application Support/Plex Media Server/Plug-in Support/Databases/"
cp com.plexapp.plugins.library.db com.plexapp.plugins.library.db.bak
Don’t skip this. Even if the database is corrupted, keep the original.
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db "PRAGMA integrity_check"
If this returns anything other than ok, the database has errors.
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db ".output recover.out" ".recover"
This tries to salvage data from a corrupted database. In my case, it wasn’t enough.
When the quick recovery doesn’t cut it, the next step is dumping the database contents and rebuilding from the dump.
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db .dump > dump.sql
rm com.plexapp.plugins.library.db
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db < dump.sql
For plexinc/pms-docker:
chown plex:plex com.plexapp.plugins.library.db
For lscr.io/linuxserver/plex:
chown abc:users com.plexapp.plugins.library.db
This also didn’t work. The rebuilt database came back as 0 bytes — the original was too far gone to recover anything useful from.
Terminal output of ls -ltrah in the Plex Databases directory on Unraid, showing dated backup files and the current database files
Here’s where the backup I’d set up months ago saved the day. Plex has a built-in scheduled backup — it’s buried in Settings > Scheduled Tasks and it’s off by default. I’d enabled it and set it to run every 3 days.
My database directory listed several clean backups:
-rw-r--r-- 1 plex users 81M Mar 18 03:16 com.plexapp.plugins.library.db-2026-03-18 -rw-r--r-- 1 plex users 81M Mar 21 02:06 com.plexapp.plugins.library.db-2026-03-21 -rw-r--r-- 1 plex users 81M Mar 24 02:06 com.plexapp.plugins.library.db-2026-03-24
I grabbed the most recent one and ran it through an integrity check first.
cp com.plexapp.plugins.library.db-2026-03-24 com.plexapp.plugins.library.db chown plex:users com.plexapp.plugins.library.db
"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db "PRAGMA integrity_check"
Output:
ok
That’s it. Restarted Plex, it came straight up, library intact.
If you’re not already running scheduled backups, turn them on before you need them.
In Plex Web, go to Settings → Scheduled Tasks and enable Backup database every X days. Three days is a reasonable interval — enough history to roll back past corruption without eating too much storage. Each backup is a full copy of the database, so on an 80MB database that’s around 240MB of backup files at any given time. Cheap insurance.
The backups land in the same directory as the live database and are named with a datestamp, making it obvious which is which.
Plex Web UI screenshot of Settings > Scheduled Tasks with the database backup schedule enabled and set to every 3 days
If you’re in a situation where backups aren’t available and the manual repair steps above haven’t worked, there’s a community tool worth knowing about: DBRepair by ChuckPa. It’s a more thorough repair utility built specifically for Plex databases, and there’s an Unraid-specific Docker support thread on the Unraid forums. Useful for large, complex libraries shared across multiple users where a backup restore isn’t an option.
For most home setups though, a clean backup beats every repair tool available.
The manual SQLite repair process works in some cases, but if the database is badly corrupted, the dump will produce a 0-byte file and you’re stuck. The real lesson here is to have the backup in place before it’s needed.
Steps that fixed it for me:
PRAGMA integrity_check to confirm the restored file was cleanEnable database backups in Plex’s Scheduled Tasks. It’s free, it’s built-in, and it’s the only thing that will save you when a repair fails.
For more Docker and self-hosting guides on Unraid, check out the Unraid category on BlackmoreOps.