Correction to Plex's "Repair Corrupt Database" Help Page

Hello all! Just wanted to share what I’ve learnt dealing with a corrupt Plex DB.

Plex has a help article on repairing it’s internal SQLlite database.

https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

The main step is to call “.dump” to read the raw DB data out. However, as desribed in detail in the below article, the “.recover” command is far superior as it can recover more data.

https://sqlite.org/cli.html#recover_data_from_a_corrupted_database

As well, if you compare the file size of the new DB to the old and it is substantially lower, you can use the “sqldiff.exe” tool (should also come from the above sqlite.org page) to see what’s missing.

1 Like

The traditional way of repairing is omitting all the index tables. That’s the main reason why the re-imported db is smaller, initially.
But those indexes are being rebuilt automatically upon the first start of Plex server.
And the ‘lost_and_found’ table that may get created by .recover, is of no use to Plex. Someone with deep knowledge of databases and of Plex will have to go in and try to attach those data to the right tables manually again.

Nonetheless, maybe the .recover command is of use in some cases. I will forward your suggestion.
Thank you for reporting it!

1 Like

.dump was not working for me.
.recover did the trick
New database is ~50% larger but no issues and passes integrity checks.
Anything I should be doing to optimise the database other than letting Plex run it’s overnight jobs?

Many thanks

No, the server maintenance is taking care of that.

I recommend do optimize the database manually, after adding or removing a lot of items at once.

My Plex database is working well. But the Check for Corruption process gives a long list of errors.

Trying to repair my database as explained in Repair a Corrupt Database page, unfortunately this process based on dump replace all french characters with “??”. But there is no more error.

And using the recover command, all french characters are kept but no error is corrected !

Have you an idea to keep the french characters within a repairing process ?

Are you trying to perform the repair on a different operating system, than where the Plex server is running?

Sure, it should be the rignt reason ! :thinking:
I will retry the repair process on the Plex server. I will keep you informed.

Yes ! Repair process OK ! French characters OK ! :+1: :star_struck:

As I said, my Plex server is working well. Probably errors like

row 6533 missing from index index_media_parts_on_file
row 4449 missing from index index_tags_on_tag_type

are not a real issue. But apparently, Plex checks these errors and doesn’t back up the database.

I will see in few days if backup files will re-appear…

@OttoKerner Thanks a lot for your help !

PS : The database clean-up doesn’t fix my other issue : Adding music videos: french artists are not recognized!

I will see in few days if backup files will re-appear…

I confirm ; a backup file is created every 3 days again.

So it’s a way to check if the database is corrupted or not.

It might be convenient to receive a notification in case of corruption. Otherwise, we have to check periodicaally the backup process.

You can with push notifications.

Great !.. But… I can’t set Notifications on my IPhone (iOS 13.4.1) :
I set Notifications Push on Plex Server. I restarted Plex Serveur and manually scanned to initialize.

On IPhone :

  • in Settings / Notifications, Plex application doesn’t appear
  • in Settings / Plex settings, there is nothing about notification,
  • in Plex App, Setting / Notifications, there is just a link to Settings / Plex settings, and nothing else to configure the type of notification.

Plex serveur, Iphone and Plex app are up to date.

What did I miss ?

In the settings of the Plex app on your phone.

I talked about the settings on my IPhone. I uninstalled and re-installed Plex app and now Notifications are Ok:

  • in Settings / Notifications, Plex application appears
  • Settings / Plex settings includes Notifications link
  • in Plex App, Setting / Notifications, firstly there is just a link to Settings / Plex settings, and after authorizing Notifications from Plex app, all options appear to configure the type of notification.

Great ! :grinning: Everything is Ok :+1:

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