Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

How do you solve a SQLLite corruption?

jk2srljk2srl Members, Plex Pass Posts: 6 Plex Pass

I am unable to clear the trash on one of my libraries. After a small run through i have come across;

Jun 18, 2017 19:44:22.049 [3480] ERROR - SQLITE3:BC0B6DDD, 11, database corruption at line 59437 of [fc49f556e4]
Jun 18, 2017 19:44:22.049 [3480] ERROR - SQLITE3:BC0B6DDD, 11, database corruption at line 59479 of [fc49f556e4]
Jun 18, 2017 19:44:22.049 [3480] ERROR - SQLITE3:BC0B6DDD, 11, statement aborts at 9: [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_items_section_location_id', medi
Jun 18, 2017 19:44:22.050 [3480] ERROR - Soci Exception handled: sqlite3_statement_backend::loadRS: database disk image is malformed

Other than removing the whole library and re-adding it which will create a new entry, how do i repair the corruption?

Answers

  • jk2srljk2srl Members, Plex Pass Posts: 6 Plex Pass

    Hello again
    Having run through the steps, I see;

    Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"
    *** in database main ***
    Page 153092: btreeInitPage() returns error code 11
    Page 153091: btreeInitPage() returns error code 11
    Page 153090: btreeInitPage() returns error code 11
    Page 153089: btreeInitPage() returns error code 11
    Error: database disk image is malformed

    When performing ; sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check

    I then ran through the repair process, dumping the db, renaming it, creating a new and attempting to copy the dump back to the new db.
    However, the process attempts to run at this step, but never copies the dump over.

    sqlite3 com.plexapp.plugins.library.db < dump.sql

    The file com.plexapp.plugins.library.db remains at 0kb. Something wrong here.
    Any assistance will be appreciated.

  • OttoKernerOttoKerner Members, Plex Pass, Plex Ninja Posts: 22,108 Plex Ninja

    Have you quit Plex before running these commands?
    (And verified it is really not active anymore with process monitor?)

    If it remains defective, you may have to resort to one of the backups.
    https://support.plex.tv/hc/en-us/articles/202485658-Restore-a-Database-Backed-Up-via-Scheduled-Tasks-
    But repair these as well before using them. The cause for the corruption might be already planted in them.

    And you should also seek the cause of the corruption.
    For instance, if you moved the Plex data folder to a network share, the corruption will happen again. It is a recipe for disaster.

  • jk2srljk2srl Members, Plex Pass Posts: 6 Plex Pass

    Thanks for your response.
    I have tried using a previous DB but the corruption is in all of them.
    I had killed Plex before running the process.
    I may just can the library and have plex rebuild that library from scratch.

  • OttoKernerOttoKerner Members, Plex Pass, Plex Ninja Posts: 22,108 Plex Ninja

    Use the opportunity to make your file names and folder organsation conducive to automatic "matching".
    Just in case they are not in shape already.
    https://support.plex.tv/hc/en-us/categories/200028098-Media-Preparation

    Filebot and similar software helps enormously.

  • jk2srljk2srl Members, Plex Pass Posts: 6 Plex Pass

    Erm --
    That didn't work
    I can't even delete or modify that library.
    The process acts like it is deleting the library, I let it run, the library still exists.
    Thinking to try the DB repair again after deleting the library -- same problem no luck..

    What else can i do ?

  • OttoKernerOttoKerner Members, Plex Pass, Plex Ninja Posts: 22,108 Plex Ninja

    CTRL-Shift-Esc
    More Details

    "Background processes"

    seek for anything with 'Plex' or 'Python' in its name and terminate it

    Do you run Plex as a system service?

  • OttoKernerOttoKerner Members, Plex Pass, Plex Ninja Posts: 22,108 Plex Ninja

    If you don't run Plex as a 'system service'
    and you can still not erase the database file, you may have a more serious problem.
    Hard disk corruption.
    CHKDSK with 'surface scan'

  • jk2srljk2srl Members, Plex Pass Posts: 6 Plex Pass

    Hey again.
    Windows had a problem, it was related to the Creator update that I had previously run.
    That in turn didn't allow for the sfc scan. Having fixed the windows problem and run the scan which checks out alright, I am still unable to repair the Database. I have also run hard drive scans on all the hard drives with the media on it and they check out OKAY.

    Regarding Plex running while attempting the repair. I have killed the Plex running as an application. I then went and killed all Plex and Python related services running. The repair still fails.

    Thank you for your help OttoKerner but I'm not sure what to do next.

  • OttoKernerOttoKerner Members, Plex Pass, Plex Ninja Posts: 22,108 Plex Ninja

    Sorry, I am out of ideas.
    I assume you'll have to go for the nuclear option:
    https://support.plex.tv/hc/en-us/articles/201941078-Uninstall-Plex-Media-Server

Sign In or Register to comment.