If your database is corrupted you can attempt to repair it.
Given it’s running on a NAS you can either connect to the NAS via SSH to run the commands or create a dummy install of Plex on your main PC to use its executables with the database files from the NAS itself.
enter ssh <QNAP account>@<QNAP IP>, replacing <QNAP account> with the name of your QNAP account and <QNAP IP> with the local IP address of your QNAP
enter the password of your QNAP account when requested
execute the command getcfg -f /etc/config/qpkg.conf PlexMediaServer Install_path – this will give you the actual path of the Plex Media Server on your QNAP (the path will vary depending on which system you have). Example:/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/
Based on the given example:
the SQLite app will be located in /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Plex SQLite.
the database file will be located in /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Plug-in Support/Databases/
Repairing the database
execute cd "/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Plug-in Support/Databases/" to navigate to the location of the database (using the actual pass derived during the preparation
execute cp com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original to create a copy of the database (so in case something goes wrong you can still revert back to that version
execute /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Plex\ SQLite com.plexapp.plugins.librrary.db ".output recover.out" ".recover" to attempt automatically repairing the database. Notice the \ in the previous command to escape the <space> in the executable name (Plex SQLite → Plex\ SQLite) – without that, your QNAP/Terminal will think SQLite is part of the parameters you want to send to an application named Plex – which doesn’t exist).
Keep in mind the database can be so badly corrupted, Plex might not be able to repair it. In that case your next steps could be to attempt restoring the last available backup. This way you will lose all changes made to the library since the last successful backup.
If that doesn’t help you can delete the database file. With that, Plex will start over with a near-new server configuration (keeping most of your config but none of your libraries / data).
I can’t even enter through a terminal! and on qnap I turned on SSH. QNAP account is what? your username, device name, email address? I’m already stuck here, so I said Chinese to me