How do you solve a SQLLite corruption?
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?
Best Answer
-
OttoKerner Posts: 29,596Members, Plex Pass, Plex Ninja 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-ServerGot help? Help others too - by reporting back with your results!
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging5
Answers
https://support.plex.tv/hc/en-us/articles/201100678-Repair-a-Corrupt-Database
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.
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.
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging
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.
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.
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging
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 ?
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?
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging
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'
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging
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.
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
Have you checked the Documentation before posting a question in the forums?
Use the SEARCH function before starting a new thread!
No PMs unless requested, please! Do not use 'verbose' logging
You can also PM me your database file and I'll see if I can fix it for you.
Plex Logs
Plex Naming Guide
Plex Dance
Plex XML
Heya OttoKerner
Thanks for your help. I do appreciate it.
I went nuclear and canned my whole Plex Library and created the library all over again.
My media is all in sensible directories so it only took 2 days to sift through the odd 12Tb's.
The media is as it was and so far no corruption. touches wood
MovieFan.Plex
Thanks for the offer although it's not needed any more. I took a look through my backups and I couldn't find a copy of the broken db. I was hoping to submit it to you for your perusal, see if you could find something amiss.
Thanks all !
Glad you are back up and running. Corruption happens sometimes. It's almost impossible to find out how it happened, but they can usually be fixed.
Plex Logs
Plex Naming Guide
Plex Dance
Plex XML