Designated Username
What “designated username” did you create? It is not necessary to create a username to use DBRepair.
Scheduled Task
What you have running as a scheduled task will not work, since you did not give DBRepair any options (stop/auto/etc.).
Run from command line
Ideally, you should initially run DBRepair from the command line, not as a scheduled task. Doing so will let you replace the database with a backup version if necessary.
Copy / Paste in a SSH window
When using SSH, do not use Ctrl+C for copy or Ctrl+V for paste. In a Linux window, Ctrl+C will cancel the command. To paste into a Linux window, use a right mouse click.
To copy from Windows & paste into SSH:
To copy/paste one of the commands below into the SSH window, select it with your mouse, then right click and choose copy. Then, change to the SSH window and click the right mouse button. It will paste the text into the window.
To copy from SSH and paste into Windows:
To copy the text in a SSH window, select it with your mouse. Left click & hold at the start of the text you wish to select. Then drag to the bottom of the text. The selected text will be highlighted. To paste, switch to the desired Windows window (text file, browser window, etc.), right mouse click, and choose paste as plain text (or just paste).
Downloading & running DBRepair
Here’s the commands to ssh to the NAS and download & run DBrepair:
# ssh to the NAS, username = your DSM login; IP = the IP address of the NAS
# On Windows run from the c:\ prompt, either CMD or PowerShell.
# On Mac/Linux, run from a terminal sessions.
c:\ssh username@IP
# cd to Plex Data Directory (DSM 7)
cd /var/packages/PlexMediaServer/shares/PlexMediaServer
# Download latest version.
# This overwrites any existing version. Remove "-O DBRepair.sh" to not overwrite.
wget -O DBRepair.sh https://github.com/ChuckPa/PlexDBRepair/releases/latest/download/DBRepair.sh
# Make it executable
chmod a+x DBRepair.sh
# Run it as root. You will be asked for the NAS admin password
sudo ./DBRepair.sh
Once DBRepair is running
stop - Plex must be stopped for DBRepair to work
auto - this combines check, repair, & reindex into one step
If auto successfully repairs the database, then start and exit.
If auto cannot repair the database, choose replace. This will lead you through using a backup of the database (the db files with dates appended). It will check to see if they are OK. If any are OK, it will replace the damaged db with the backup. Then you can start and exit.
Example: SSH to Synology NAS, login, and launch DBRepair
c:\>ssh l0newo1f@192.168.1.49
The authenticity of host '192.168.1.49 (192.168.1.49)' can't be established.
ECDSA key fingerprint is <deleted>.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.49' (ECDSA) to the list of known hosts.
l0newo1f@192.168.1.49's password:
Synology strongly advises you not to run commands as the root user, who has
the highest privileges on the system. Doing so may cause major damages
to the system. Please note that if you choose to proceed, all consequences are
at your own risk.
L0neWo1f@tonkawa:~$ cd /var/packages/PlexMediaServer/shares/PlexMediaServer
L0neWo1f@tonkawa:/var/packages/PlexMediaServer/shares/PlexMediaServer$ wget -O DBRepair.sh https://github.com/ChuckPa/PlexDBRepair/releases/latest/download/DBRepair.sh
--2024-09-28 10:19:07-- https://github.com/ChuckPa/PlexDBRepair/releases/latest/download/DBRepair.sh
< Download lines deleted>
2024-09-28 10:19:09 (6.36 MB/s) - 'DBRepair.sh' saved [67768/67768]
L0neWo1f@tonkawa:/var/packages/PlexMediaServer/shares/PlexMediaServer$ chmod a+x DBRepair.sh
L0neWo1f@tonkawa:/var/packages/PlexMediaServer/shares/PlexMediaServer$ sudo ./DBRepair.sh
Password:
Plex Media Server Database Repair Utility (Synology (DSM 7))
Version v1.07.00
Select
1 - 'stop' - Stop PMS.
2 - 'automatic' - Check, Repair/Optimize, and Reindex Database in one step.
3 - 'check' - Perform integrity check of database.
4 - 'vacuum' - Remove empty space from database without optimizing.
5 - 'repair' - Repair/Optimize databases.
6 - 'reindex' - Rebuild database database indexes.
7 - 'start' - Start PMS
8 - 'import' - Import watch history from another database independent of Plex. (risky).
9 - 'replace' - Replace current databases with newest usable backup copy (interactive).
10 - 'show' - Show logfile.
11 - 'status' - Report status of PMS (run-state and databases).
12 - 'undo' - Undo last successful command.
21 - 'prune' - Prune (remove) old image files (jpeg,jpg,png) from PhotoTranscoder cache.
42 - 'ignore' - Ignore duplicate/constraint errors.
88 - 'update' - Check for updates.
99 - 'quit' - Quit immediately. Keep all temporary files.
'exit' - Exit with cleanup options.
Enter command # -or- command name (4 char min) :