Corrupt db, using the posted method to fix results in a zero byte file

Hello,

Got a corrupt database im trying to fix, following the directions here https://support.plex.tv/articles/201100678-repair-a-corrupt-database/ however the resulting output is a zero byte file. with no errors for sqlite3. Any advice would be apprecaited as currently my plex seems to crash an awful lot and suspect its the corrupt db causing it

Plex Scheduled Tasks should have made a backup of your database. It should be located here…
%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases

More info.
https://support.plex.tv/articles/201553286-scheduled-tasks/

Wont fix it apparently its a very old corruption.

@dunewarrior said:
Wont fix it apparently its a very old corruption.

You should see a few com.plexapp.plugins.library.db-2018-04-xx files. Are you not seeing these files?
Or, are you saying all the backups are bad?

all backups are bad, suspecting its a corruption from WAY back

@dunewarrior said:
all backups are bad, suspecting its a corruption from WAY back

Well, that sucks… You may be able to fix one of the corrupt backup databases but I wouldn’t hold my breath though…

You may be stuck and will have to re-create your libraries again.

So basically what your suspecing is that the export import of the db into sql wont fix it … which makes sense as i get a few errors on the import. However eremoving the error lines which are all related to ratings regions still results in a zero byte file.

Wondering if there is no way to recreate the media without having to totally reinstall Plex. i could sort of accept to redo the library kind of, just sucks if there is no way to actually do a repair

I’m just trying to understand why the corruption went so deep.

From the support article -> https://support.plex.tv/articles/201553286-scheduled-tasks/

Backup database every three days

  • Every three days, a backup of your core SQL database file will be created (if it is not already corrupted). This is the database that holds your media viewstate and other critical information. A backup can help protect against corruption which can occur in rare cases when a machine is powered down unexpectedly, for example.

@dunewarrior said:
Wondering if there is no way to recreate the media without having to totally reinstall Plex.

You do not have to reinstall.
From the support article → https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

  • Note: You can also simply deleting the com.plexapp.plugins.library.db database file while the Plex Media Server is not running. Restarting the server will then restore your server to a nearly-fresh install state. (i.e. You will lose your existing libraries and need to recreate them, but you won’t be affecting your content itself.)

Yeah its just the whole download of media info and all.

Think the corruption been there for AGES - as in years - and the fact that plex dont seem to do a pragma check and solve it or report it means i never really did notice … cuz im slack and dont keep track of the rebooting of the server to be honest

@dunewarrior said:
Yeah its just the whole download of media info and all.

Think the corruption been there for AGES - as in years - and the fact that plex dont seem to do a pragma check and solve it or report it means i never really did notice … cuz im slack and dont keep track of the rebooting of the server to be honest

Hmmm… Is your server up and running right now?
If so, why don’t you try to download the database within PMS.

@NewPlaza said:

@dunewarrior said:
Yeah its just the whole download of media info and all.

Think the corruption been there for AGES - as in years - and the fact that plex dont seem to do a pragma check and solve it or report it means i never really did notice … cuz im slack and dont keep track of the rebooting of the server to be honest

Hmmm… Is your server up and running right now?
If so, why don’t you try to download the database within PMS.

How do you mean ? not sure i follow

Of course I have no idea if Plex will run a pragma check before the download… but I guess it couldn’t hurt…

@dunewarrior said:

@NewPlaza said:

@dunewarrior said:
Yeah its just the whole download of media info and all.

Think the corruption been there for AGES - as in years - and the fact that plex dont seem to do a pragma check and solve it or report it means i never really did notice … cuz im slack and dont keep track of the rebooting of the server to be honest

Hmmm… Is your server up and running right now?
If so, why don’t you try to download the database within PMS.

How do you mean ? not sure i follow

SETTINGS → SERVER → HELP >> Download Database

Never-mind… I take it all back. The help tab in Plex is for diagnosing issues… It would be completely stupid if Plex did do a pragma check before the download cause that would defeat the point of obtaining the logs/database for diag purposes.

@NewPlaza said:

@dunewarrior said:

@NewPlaza said:

@dunewarrior said:
Yeah its just the whole download of media info and all.

Think the corruption been there for AGES - as in years - and the fact that plex dont seem to do a pragma check and solve it or report it means i never really did notice … cuz im slack and dont keep track of the rebooting of the server to be honest

Hmmm… Is your server up and running right now?
If so, why don’t you try to download the database within PMS.

How do you mean ? not sure i follow

SETTINGS → SERVER → HELP >> Download Database

More fun, that downloads a 1KB empty zip file, though my DB 56,369,152 bytes :persevere:

Yeah noticed the diag parts too however an empty zip is still… wrong lol

@dunewarrior said:
Yeah noticed the diag parts too however an empty zip is still… wrong lol

That is true but for troubleshooting purposes it would make sense to keep the database as is (corrupt) without modifications so it could be uploaded for others to examine. If it did infact do a pragma check beforehand and “fixed” the issue then what you would get back from those you were helping was “I can’t find anything wrong. Your database seems fine”. Of course you wouldn’t see it that way.

@NewPlaza said:

@dunewarrior said:
Yeah noticed the diag parts too however an empty zip is still… wrong lol

That is true but for troubleshooting purposes it would make sense to keep the database as is (corrupt) without modifications so it could be uploaded for others to examine. If it did infact do a pragma check beforehand and “fixed” the issue then what you would get back from those you were helping was “I can’t find anything wrong. Your database seems fine”. Of course you wouldn’t see it that way.

Agree, well hopefully the whole repair process can be looked at or enligtened upon as its the recreation of the DB not the export into sql thats messing up

Figured it out. apparently SQLITE adds a ROLLBACK to the sql dump now IF there is a fault encountered during the dump process, which there is. SO the FAQ needs updated and the ROLLBACK in the dump file needs changed into a COMMIT. i will try that on mine and post results.