PLEX: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed


Go to solution Solved by jmztaylor,

Recommended Posts

So, 

 

Over the weekend in Southern Ontario we got hit with some pretty bad winds and my power was out and caused some damage to my unraid server. 

 

One of my disks failed and I was able to re-build that disk. However, my appdata seems to have taken some damage as well. I did a restore of the appdata and have been reinstalling my dockers and I am unable to get plex to work. This is the error I am getting in the Logs:

 

Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)

 

 

I followed spaceinvaders "How to fix a Corrupt Plex Database" video as well as this reddit post: https://www.reddit.com/r/PleX/comments/qitj8k/database_errors_seemingly_unrepairable/

 

when I do an integrity check using  

"Plex SQLite" "$DB" "PRAGMA integrity_check"

I get the response back "ok", so it seems like those solutions are "working" but not fixing my problem. I tried to rollback to an earlier version of the plex db, but had the same problem. I am at a loss as to what I should try next. 

 

Any help is appreciated. 

tower-diagnostics-20220525-1518.zip

Link to comment
  • Solution

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

Edited by jmztaylor
  • Like 4
  • Thanks 2
  • Upvote 1
Link to comment
9 minutes ago, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

 

Unfortunately, that didn't do anything. Still throws :

 

 

Starting Plex Media Server.
Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)

Starting Plex Media Server.
Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)

Starting Plex Media Server.
Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)

Starting Plex Media Server.
Error: Unable to set up server: sqlite3_statement_backend::prepare: database disk image is malformed for SQL: PRAGMA cache_size=2000 (N4soci10soci_errorE)

[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 01-migrations: executing...
[migrations] started
[migrations] no migrations found
[cont-init.d] 01-migrations: exited 0.
[cont-init.d] 02-tamper-check: executing...
[cont-init.d] 02-tamper-check: exited 0.
[cont-init.d] 10-adduser: executing...
usermod: no changes

-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid: 99
User gid: 100
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 40-chown-files: executing...
[cont-init.d] 40-chown-files: exited 0.
[cont-init.d] 45-plex-claim: executing...
[cont-init.d] 45-plex-claim: exited 0.
[cont-init.d] 50-gid-video: executing...
[cont-init.d] 50-gid-video: exited 0.
[cont-init.d] 60-plex-update: executing...
Docker is used for versioning skip update check
[cont-init.d] 60-plex-update: exited 0.
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-scripts: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-scripts: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting Plex Media Server.

 

Link to comment
  • 3 months later...
On 5/25/2022 at 8:31 PM, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

 

Thanks, this worked for me.

Link to comment
  • 2 months later...
On 5/25/2022 at 12:31 PM, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.


What's the path for those files?

Link to comment
On 11/23/2022 at 3:31 PM, jmztaylor said:

 

Wherever you have appdata going.  

 

For example mine is at

/mnt/cache/appdata/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases

 


Hmm...the only things I have there are the two that are supposed to be copied back from backup...

Edited by rmp5s
Link to comment
  • 2 months later...
  • 4 weeks later...
On 5/25/2022 at 9:31 PM, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

🙏 my Plex went down on the worst possible time, when I have no time to troubleshoot. Following your steps got him running again in literally 5 mins!

 

fasted way:

- using cloud commander (app)

- rename “databases folder” to something new

- create new one

- move the 2 backup files, like mentioned. Same time stamp!

- rename said files = removing the time stamp

- start Plex

 

and with a bit of luck? All is well again!

 

 

 

 

  • Like 1
Link to comment
  • 2 months later...
On 5/25/2022 at 9:31 PM, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

Thanks, I resolve the problem too.

Link to comment
  • 6 months later...
On 5/25/2022 at 3:31 PM, jmztaylor said:

I've had issues restoring from backups with Plex.  But for me to get it to work I had to delete multiple files and then only restore the 2 .db files and start plex again.

 

Of course make backups of these files first.

 

Shutdown plex

 

Delete: 

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.blobs.db-shm

com.plexapp.plugins.library.blobs.db-wal

com.plexapp.plugins.library.db

com.plexapp.plugins.library.db-shm

com.plexapp.plugins.library.db-wal

 

Restore ONLY (copy from backup):

com.plexapp.plugins.library.blobs.db

com.plexapp.plugins.library.db

 

Start plex again.  See if that works for you.  If the other DB files in that directory are not corrupted you might be able to restore one of the dated ones that are in this folder.  Also make sure the date stamps you restore are the same dates.

This also worked for me, thank you! 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.