So after searching the internet and looking at various sites and reading tips and tricks, here is a guide on how to solve this problem:
- Shut down Plex Media Server so that it is not running.
- Go to File Explorer and find the hard drive that your Plex database is stored on.
- Right click on the hard drive and click on Properties.
- Click on the tab named Tools.
- In the error checking box click on the Check-button.
- If Windows find something wrong, just follow the instructions and Windows will fix it.
- Open a Command Prompt window and go the drive and location where your Plex database is located. Example, if your database is stored on drive N:\ and you have a folder named Plex, then the command you type would look like this
cd "N:\Plex\Plex Media Server\Plug-in Support\Databases"
or if you haven’t changed the path and it’s stored in the default location you just do this
cd "%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases"
- First we’ll make a copy of your database just in case.
copy com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
- Check if your database have corruption. (change the file path if you do not have Plex installed with default path)
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" com.plexapp.plugins.library.db "PRAGMA integrity_check"
- Even if the integrity check doesn’t return errors, it can still sometimes help to try and repair the database. With the Plex SQLite interpreter, you can easily attempt a repair with 1 command. The following command will attempt an automatic repair and store the result in a file named recover.out.
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" com.plexapp.plugins.library.db ".output recover.out" ".recover"
The above command will reassemble your database with all the valid data it can find in your file.
-
Restart your computer and see if this solved the problem. If the problem persist after this then I’m sorry to tell you that you’ll need to do a completely fresh install of Plex Media Server and a completely new database, so continue to next step.
-
First shut down Plex Media Server so that it is not running.
-
Open a Command Prompt window and go the drive and location where your Plex database is located. Example, if your database is stored on drive N:\ and you have a folder named Plex, then the command you type would look like this
cd "N:\Plex\Plex Media Server\Plug-in Support\Databases"
or if you haven’t changed the path and it’s stored in the default location you just do this
cd "%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases"
Just like you did before in step 7.
- Now we’re going to backup your settings, watched/unwatched, view progress, and ratings into a file named settings.sql
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" com.plexapp.plugins.library.db
The command line should now start with sqlite>
sqlite> .output settings.sql
sqlite> .dump metadata_item_settings
And hit enter. When it’s finished you will see sqlite> again. Then click CTRL + C.
15. If you copy the path you’re seeing in Command Prompt and open that one up in a File Explorer window you should now see a file named settings.sql there.
16. Copy or move this file somewhere safe.
17. Uninstall Plex Media Server from your computer.
16. Delete the folder named Plex Media Server. This will delete your entire database and everything it has stored like posters, thumbnails and so on.
17. Install the latest Plex Media Server version. Do not launch Plex Media Server after install if you want the database stored on a different hard drive than the default (default is C:). If you want to store the database on a different drive then follow this guide
18. Launch Plex and add your libraries. Let it finish with scanning and adding media. For huge databases this will take a while, so go and do something else and continue when Plex Media Server is done.
19. When Plex Media Server is done with all your libraries, shut it down.
20. Now it’s time to copy settings.sql back into the Plex Media Server/Plug-in Support/Databases/ folder. From the Command Prompt terminal in that folder you run the following code
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" com.plexapp.plugins.library.db
And to insert your settings the following:
sqlite> .read settings.sql
- Start Plex Media Server back up again. Your settings, watched status and so on should now be back and everything is now working again, but you are now using the newer and smarter database which Plex added earlier this year (2021).
And this is the solution people, the only one that actually works. Unfortunately for me I had to go all the steps. My database was more than 7 years old and probably had a lot of crap and bugs from previous versions of Plex Media Server throughout the years. At least now I have a clean and new database which is supposedly much smarter and faster than before. 
I hope this helps everyone else experiencing this issue. Maybe some Plex moderators could put all this into an article on their site. Good luck!