DBRepair development

It’s not necessarily available inside a docker container and lots of users are using those.

Agreed.

So the 2 options could be:

  • Auto (as now, without deflate)
  • Deflate then Auto (but checking if necessary first then confirming)

?

ALL:

DBRepair v1.12.00 is now available for your consideration

https://github.com/ChuckPa/DBRepair/releases/tag/v1.12.00

Please be certain to see the Release Notes about process performance.

Sample behavior:

Check and Deflate started.

Checking the PMS databases
Check complete.  PMS main database is OK.
Check complete.  PMS blobs database is OK.

Backup current databases with '-BACKUP-2025-10-20_23.33.28' timestamp.
Starting Deflate (Part 1 of 2 - Repair database table)
  This should take approx 1 minutes but is I/O speed dependent

PMS main database successfully repaired.
Starting Deflate (Part 2 of 2 - Reduce size)
PMS main database size reduced.
Verifying PMS main database.
Verification complete.  PMS main database is OK.
PMS main database reduced from 115 MB to 115 MB
Saving current main database with '-BLOATED-2025-10-20_23.33.28'
Making deflated database active
PMS main database deflate completed.
Deflate successful.
1 Like

Hi @ChuckPa

This should take approx 1 minutes but is I/O speed dependent

Is this calculated based on size of Db and system Plex is running on?

cheers.

@ChuckPa I tried out the 1.12.00 and found no problems here.
Thanks.

The code shows it to be approximated as (DBSize / 2).

1 Like

I need advice for a script on Synology:
ChuckPa mentioned on the GitHub page the “all in one” run with this command:

#!/bin/bash

Go to the PlexMediaServer shared folder

cd /var/packages/PlexMediaServer/shares/PlexMediaServer

Run classic Stop PMS, Automatic optimization/repair, Start PMS, and exit sequence

sudo ./DBRepair.sh stop auto start exit`

I run this script on the scheduled task weekly as user as root. So far so good :grinning_face:

.

Now I added the update command to the script:

#!/bin/bash

Go to the PlexMediaServer shared folder

cd /var/packages/PlexMediaServer/shares/PlexMediaServer

Stop PMS, Check for updates, Start PMS and exit sequence

sudo ./DBRepair.sh stop update start exit

Unfortunately the script says “last modifed on August 2025” so I doubt that it has been updated. Did I forget something here?
Please keep in mind I have nearly zero coding knowledge and only opened Port 22 for installing this tool (before I never used it).

ALL:

  1. The estimate is based on testing using an ARMv8 CPU with SATA SSD
    (older QNAP TS-128A machine).

    The estimate is based on the test. 31 GB / 15m 20s → approx 2GB/min

    The script uses simple (Size in GB / 2 GB ) + 1 to estimate total time required.

  2. It seems I messed up the README file. There is no reference to Deflate (option 23) in the release. I will be re-releasing v1.12.00 (no need for v1.12.01)

I would make two runs:

  1. Stop Update Start Exit
  2. Now perform your normal work.

Update does properly restart on most machines but not all.
I therefore recommend being safe about it.
–OR–
Manually download and install the update yourself. in the PlexMediaServer shared folder (best option)

@Fluamsler

I created a separate Scheduled Task in DSM to download the latest version. I run it manually when a new version of DBRepair is released.

It uses wget to download from GitHub. Run the scheduled task as root.

Enable notifications in DSM to receive an e-mail when a task completes. Synology Control Panel → Notification → Email tab → Email.

Edit / Note: I do not receive notifications via my Synology Account for this task (either e-mail or push). I have to add my gmail account in Sender email in the Email section. This might be user error, but I cannot find a way to have notifications via my Syno account.

#!/bin/bash

# cd to DSM 7.x Plex Data Directory
cd /var/packages/PlexMediaServer/shares/PlexMediaServer

# Download latest version. This overwrites any existing version.  
wget -O DBRepair.sh https://github.com/ChuckPa/DBRepair/releases/latest/download/DBRepair.sh

# Make it executable
chmod a+x DBRepair.sh

body of e-mail notification when task completes
Task Scheduler has completed a scheduled task.

Task: DBRepair Download
Start time: Tue, 21 Oct 2025 12:55:24 -0500
Stop time: Tue, 21 Oct 2025 12:55:25 -0500
Current status: 0 (Normal)
Standard output/error:

--2025-10-21 12:55:24-- https://github.com/ChuckPa/DBRepair/releases/latest/download/DBRepair.sh
Resolving github.com... 140.82.114.3
Connecting to [github.com](http://github.com/)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github.com/ChuckPa/DBRepair/releases/download/v1.12.00/DBRepair.sh [following]
--2025-10-21 12:55:24-- https://github.com/ChuckPa/DBRepair/releases/download/v1.12.00/DBRepair.sh
Reusing existing connection to [github.com:443](http://github.com:443/).
HTTP request sent, awaiting response... 302 Found
Location: https://release-assets.githubusercontent.com/github-production-release-asset/531714386/303bda72-9708-4609-9375-3a516fe80434?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-10-21T18%3A50%3A57Z&rscd=attachment%3B+filename%3DDBRepair.sh&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-10-21T17%3A50%3A24Z&ske=2025-10-21T18%3A50%3A57Z&sks=b&skv=2018-11-09&sig=b6NHswyF8UyQtwO8tZo%2F9SVrvoifm%2BbtXlAvfHK9yIk%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MTA2OTYyNCwibmJmIjoxNzYxMDY5MzI0LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.OkTRwRqz581ijGBt8vZLJT3DFhz1LY82uXV3UBFaHk4&response-content-disposition=attachment%3B%20filename%3DDBRepair.sh&response-content-type=application%2Foctet-stream [following]
--2025-10-21 12:55:24-- https://release-assets.githubusercontent.com/github-production-release-asset/531714386/303bda72-9708-4609-9375-3a516fe80434?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-10-21T18%3A50%3A57Z&rscd=attachment%3B+filename%3DDBRepair.sh&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-10-21T17%3A50%3A24Z&ske=2025-10-21T18%3A50%3A57Z&sks=b&skv=2018-11-09&sig=b6NHswyF8UyQtwO8tZo%2F9SVrvoifm%2BbtXlAvfHK9yIk%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MTA2OTYyNCwibmJmIjoxNzYxMDY5MzI0LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.OkTRwRqz581ijGBt8vZLJT3DFhz1LY82uXV3UBFaHk4&response-content-disposition=attachment%3B%20filename%3DDBRepair.sh&response-content-type=application%2Foctet-stream
Resolving release-assets.githubusercontent.com... 185.199.111.133, 185.199.109.133, 185.199.108.133, ...
Connecting to [release-assets.githubusercontent.com](http://release-assets.githubusercontent.com/)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 81334 (79K) [application/octet-stream]
Saving to: 'DBRepair.sh'

0K .......... .......... .......... .......... .......... 62% 19.2M 0s
50K .......... .......... ......... 100% 87.0M=0.003s

2025-10-21 12:55:24 (27.0 MB/s) - 'DBRepair.sh' saved [81334/81334]

Forgive the simplistic question I’m about to ask :slight_smile:
It’s just updating a file. Why stop and start PMS?

I was thinking there would be two cron jobs run >= 10min apart.

  1. sudo ./DBRepair.sh update exit
  2. sudo ./DBRepair.sh stop auto start exit

I like what @FordGuy61 mentioned,
text message, recent commit summaries, link to the project
in case I’m busy

@nibbles

Sorry, wrote that wrong.

You’re right.

Start, Update, Exit
Start , — do your stuff here — , exit

Huge thanks! for the script! :grinning_face: I’ve added this to my NAS and let it run a couple of minutes before I start the DBRepair tool.

BTW: I also don’t receive any notification mails from the scheduled task window. The emails from Hyper Backup for both of my backup jobs (offsite backup at 8 PM and my HDD backup at 2 AM) work without any problems. Even if I re-added the credentials to Synology I doubt that we both miss-typed informations so I guess it’s more likely that Synology messed something up here! :wink:

@ChuckPa
Thanks for the hint! You’re right I guess it is better to create two smaller scripts than putting too many commands into one file and risking messing something up. I’ll keep this in mind. :grinning_face:

ALL:

Fixed a couple mistakes in the documentation & math

v1.12.01 is available for your consideration

2 Likes

Would someone help me understand what log messages
EDIT: solved

Re v1.13. What is Binhex?

Docker.

## Hosts currently supported

        1. Apple (MacOS)
        2. ASUSTOR
        3. Docker containers via 'docker exec' command (inside the running container environment)
           - Plex,inc.
           - Linuxserver.io
           - BINHEX
           - HOTIO
           - Podman (libgpod)
        4. FreeBSD (14+)
        5. Linux workstation & server
        6. MacOS
        7. Netgear (OS5 Linux-based systems)
        8. QNAP (QTS & QuTS)
        9. Synology (DSM 6 & DSM 7)
       10. Western Digital (OS5)
1 Like

ALL:

DBRepair v1.14.00 is now available for your consideration.

  1. Add support for Full-Text Search (FTS v4) index checking
  2. Repair FTS4 indexes when damaged

HUGE thanks to @maxfield-allison for his great work.

DO NOT be surprised if it finds FTS errors when you run it.

FTS index errors have been lurking for some time.
They typically manifest as Collections problems but I won’t be surprised to find they have greater impact in PMS.

9 Likes

First time running this updated script and it found bad fts indexes in my db …

2026-01-28 22.52.04 - Auto    - FTS Check: fts4_metadata_titles - FAIL (Error: stepping, database disk image is malformed (11))
2026-01-28 22.52.05 - Auto    - FTS Check: fts4_metadata_titles_icu - FAIL (Error: stepping, database disk image is malformed (11))
2026-01-28 22.52.05 - Auto    - FTS Check: fts4_tag_titles - FAIL (Error: stepping, database disk image is malformed (11))
2026-01-28 22.52.07 - Auto    - FTS Check: fts4_tag_titles_icu - FAIL (Error: stepping, database disk image is malformed (11))
2026-01-28 22.52.07 - Auto    - FTS Check (blobs): fts4_metadata_titles - PASS
2026-01-28 22.52.07 - Auto    - FTS Check (blobs): fts4_metadata_titles_icu - PASS
2026-01-28 22.52.07 - Auto    - FTS Check (blobs): fts4_tag_titles - PASS
2026-01-28 22.52.07 - Auto    - FTS Check (blobs): fts4_tag_titles_icu - PASS
2026-01-28 22.52.07 - Auto    - FTS Check - FAIL
2026-01-28 22.52.07 - Auto    - FTS damaged, attempting rebuild
2026-01-28 22.52.07 - FTSRbld - MakeBackup com.plexapp.plugins.library.db - PASS
2026-01-28 22.52.07 - FTSRbld - MakeBackup com.plexapp.plugins.library.blobs.db - PASS
2026-01-28 22.52.07 - FTSRbld - MakeBackup - PASS
2026-01-28 22.52.07 - FTSRbld - Rebuild: fts4_metadata_titles - PASS
2026-01-28 22.52.09 - FTSRbld - Rebuild: fts4_metadata_titles_icu - PASS
2026-01-28 22.52.13 - FTSRbld - Rebuild: fts4_tag_titles - PASS
2026-01-28 22.52.19 - FTSRbld - Rebuild: fts4_tag_titles_icu - PASS
2026-01-28 22.52.19 - FTSRbld - Rebuild (blobs): fts4_metadata_titles - PASS
2026-01-28 22.52.19 - FTSRbld - Rebuild (blobs): fts4_metadata_titles_icu - PASS
2026-01-28 22.52.19 - FTSRbld - Rebuild (blobs): fts4_tag_titles - PASS
2026-01-28 22.52.19 - FTSRbld - Rebuild (blobs): fts4_tag_titles_icu - PASS
2026-01-28 22.52.19 - FTSRbld - PASS
2026-01-28 22.52.19 - Auto    - FTS Rebuild - PASS

… never noticed any search problem really, outside of it being a little slow. I wonder if it might be worth putting this index rebuild/repair in some future pms build so everyone’s indexes can be checked.

1 Like

same. Never noticed any search problems, but…

Enter command # -or- command name (4 char min) : 3
 
Checking the PMS databases
Check complete.  PMS main database is OK.
Check complete.  PMS blobs database is OK.

Checking FTS (Full-Text Search) indexes
  FTS index 'fts4_metadata_titles' - DAMAGED
    Error: Error: stepping, database disk image is malformed (11)
  FTS index 'fts4_metadata_titles_icu' - DAMAGED
    Error: Error: stepping, database disk image is malformed (11)
  FTS index 'fts4_tag_titles' - DAMAGED
    Error: Error: stepping, database disk image is malformed (11)
  FTS index 'fts4_tag_titles_icu' - DAMAGED
    Error: Error: stepping, database disk image is malformed (11)
  FTS index 'fts4_metadata_titles' (blobs) - OK
  FTS index 'fts4_metadata_titles_icu' (blobs) - OK
  FTS index 'fts4_tag_titles' (blobs) - OK
  FTS index 'fts4_tag_titles_icu' (blobs) - OK
FTS integrity check complete. One or more FTS indexes are DAMAGED.
Use 'reindex' command (option 6) or 'automatic' (option 2) to rebuild.

NOTE: FTS indexes are damaged but main database structure is OK.
      Use 'reindex' (option 6) or 'automatic' (option 2) to rebuild.

Thanks, Chuck.

Is the PowerShell script (Windows) also updated with this latest feature?