Database corruption / Database disk image is malformed

Hi All,



My PMS is scanning the sections every few minutes, although its set for scanning twice a day.



I see in the logs that there is a database corruption, see the scanner log below.



Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] DEBUG - Opening database session to library, SQLite 3.6.23.1, threadsafe=1<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] ERROR - SQLITE3:bffff348, 11, database corruption found by source line 39905<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] ERROR - SQLITE3:bffff348, 11, database corruption found by source line 39943<br />
Oct 23, 2010 22:42:08 [0xa0a8c500] ERROR - SQLITE3:bffff348, 11, statement aborts at 5: [select id from directories where library_section_id=?] <br />




Is there any hope of recovering the database, i have already run "Optimize database". If not what do i have to do to delete the database and start all over again.

The rest of the logs are in the attached file

Greets

Rob

This really shouldn’t happen, but I’ve heard of a few instances where people have powered off their machine in the middle of heavy database access, which can cause the problem.



You can follow the instructions here (OS X comes with sqlite3 installed) to try to fix with an export followed by an import. The database file in question is ~/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db



I had trouble with the link provided, but found extra help here and it worked: http://forums.zotero.org/discussion/2607/.

Thanks,
Simon

I am having the same problem, but I’m not a terminal ninja. I do need to use the terminal to fix the database right? Could I maybe get a little more guidance on using the sqlite3 tool that’s part of OS X? I’m on lion btw.




Can't speak for Lion, but the command "sqlite3" exists on Snow Leopard and everything works the same as the document. The only difference is that I had to perform the "PRAGMA" command within SQL rather than as a 1-liner command.

(Another reason why I wish that old Plex DBEditor program was around; Plex ofers no database export, clear, and import options to recover a corrupted DB. Power outages DO happen; Hard drives do crash, files and directories can get corrupted ...

You can also restore a backup: https://support.plex.tv/hc/en-us/articles/202485658-Restore-a-Database-Backed-Up-via-Scheduled-Tasks-

2 Likes

Restoring the previous backup worked for me. Thanks!

I just found this from a google search after I had a problem with the database too.

It happened when it tried to add media with a French named title.

Jun 22, 2019 15:20:03.549 [0x1507c9b53700] ERROR - SQLITE3:(nil), 11, database corruption at line 68035 of [bf8c1b2b7a]
Jun 22, 2019 15:20:03.549 [0x1507c9b53700] ERROR - SQLITE3:(nil), 11, statement aborts at 9: [SELECT (SELECT max(idx) FROM 'main'.'fts4_metadata_titles_segdir' WHERE level = ?) + 1] database disk image is malformed
Jun 22, 2019 15:20:03.549 [0x1507c9b53700] ERROR - SQLITE3:(nil), 11, statement aborts at 91: [delete from metadata_items where library_section_id=?] database disk image is malformed
Jun 22, 2019 15:20:03.549 [0x1507c9b53700] ERROR - Exception inside transaction (inside=1) (../Library/Scanner/LibrarySection.cpp:358): sqlite3_statement_backend::loadOne: database disk image is malformed
Jun 22, 2019 15:20:03.550 [0x1507c9b53700] ERROR - Thread: Uncaught exception running async task which was spawned by thread 0x1507ca156700: sqlite3_statement_backend::loadOne: database disk image is malformed

Version 1.16.1.1246

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