DBRepair development

Here it is. Testing completed.

[2026-07-03 22.47.38] 
[2026-07-03 22.47.38]   Sqlite3 Cache Size  [0]
[2026-07-03 22.47.38]   Sqlite3 Page Size   [32768]
[2026-07-03 22.47.38]   DBRepair Notify Cmd [Hello there you PEBKAC]
[2026-07-03 22.47.38]  
  • Sqlite3 Cache Size = 0 (let the OS & Sqlite3 determine the I/O buffer size)
  • Sqlite3 Page Size == DBREPAIR_PAGESIZE value from the environment
  • DBREPAIR Notify Cmd = “Whatever you want in that command”

Have a great holiday everyone!

Made progress today.

Windows executable lives.
It doesn’t do anything functional yet but spit errors :slight_smile:

Here’s the best it can currently do.
It accepts and validates the --databases directory then continues in manual mode.

(it has no identification or personality detection yet)

Folks,

I had some free time.

DBRepair now understands Windows configurations. (somewhat)

I would appreciate feedback.

  1. It understands C:\Users\username\AppData\Local
  2. It understands C:\Users\username\AppData\Roaming

The screenshot below is from Windows 11 VM and DBRepair automagically configuring itself.

Guidance appreciated
Additionally, if anyone understands the mysteries of ICU, I would be appreciative

Binaries now built are:

pc-darwin-arm64-release
pc-darwin-x86_64-release
pc-linux-arm32-release
pc-linux-arm64-release
pc-linux-x86_64-release
pc-windows-x86_64-release

Where do I download the binaries @ChuckPa ?

I’ve only ever downloaded the dbrepair.sh script from your Github, or am I missing something (as usual)?

:smiley:

I’ve not posted binaries yet because I’ve not finished testing with all the databases I have.

I’m looping through all the DBs with

  1. Test
  2. Fix
  3. Go back to step 1

It’s a lot of little things but it is getting closer.

I will be having a few folks help me test.

Hosts needing to be tested by others are:

  1. Armv7 Linux (pc-linux-arm32)
  2. X86_64 MacOS (pc-darwin-x86_64)
  3. Win 64 (pc-windows-x86_64) — My VM is painful to use.
  4. Any other configuration/NAS/Containers DBRepair.sh already runs on.
    ( I can test Darwin-arm64, Linux-arm64 and Linux-x86_64)

Anyone interested in helping, please let me know

My PMS runs on macOS (ARM64) so happy to test that when you are ready, but sounds like you have that one covered anyway.

FOLKS:

I would like to introduce DBRepair 0.1999.01 (ALPHA ALPHA TEST :see_no_evil_monkey: )

This is the full rewrite of DBRepair into executable program form.

IMPORTANT:

  • PLEASE Backup your Databases prior to testing.

  • Only three things really work:
    – Auto detection
    – Check command
    – Repair command (which now does a whole lot. See Doc in ZIP file)

  • Simple commands also work
    – Start / Stop
    – Show
    – Status
    – Prune
    – Ignore / Honor

I am looking for feedback on:

  1. Does it startup ok and auto configure ?
  2. Did it properly diagnose any errors ?
  3. Did it repair & rebuild everything correctly ?
  4. Does it run as fast (or hopefully much faster) than DBRepair.sh ?
  5. Please scrutinize so I know what’s still lacking / sloppy.

Command line options:

  • -v = Verbose output
  • –databases DirectoryPath (requires ‘sudo’ at this time)

How to use:

  • Start program
  • Run “Check”
  • Output the ‘Config’
  • Repair to do it’s thing if you ‘feel lucky’ :wink:

HIDDEN COMMAND:

Config - Shows you all of DBRepair’s program internal variables.

When reporting error(s), please include the output of the “Config” command.

Binaries are below.

Thanks,
C.

Forgot to show the console log.

SYSTEM: macOS,(MacOS)
ENGINE: SQLite v3.53.0
STEEL:  ICU Headers LINKED
[Smoke Test Complete]
Binary Architecture: 64-bit




      Database Repair Utility for Plex Media Server  (MacOS)
                       Version 0.1999.01 (Jul  8 2026)

[2026-07-09 00.58.58]  
[2026-07-09 00.58.58] Stopping PMS. (60 second max delay)
[2026-07-09 00.59.04] Stopped PMS.
[2026-07-09 00.59.04]  
[2026-07-09 00.59.04] Checking the PMS databases...
[2026-07-09 00.59.04] Database is damaged: row 67 missing from index index_title_sort_icu
[2026-07-09 00.59.04]   PMS main database is damaged.
[2026-07-09 00.59.04]   PMS blobs database is damaged.
[2026-07-09 00.59.04] 
[2026-07-09 00.59.06] Checking the PMS databases... complete.
[2026-07-09 00.59.06]  
[2026-07-09 00.59.06] --- Processing Main DB ---
[2026-07-09 00.59.07] Rebuilding and Verifying Main DB structure...
[2026-07-09 00.59.07] Rebuilding pristine indexes from source schema...
[2026-07-09 00.59.08] Rebuilding FTS Virtual Tables for ...

[2026-07-09 00.59.10] --- Processing Blobs DB ---
[2026-07-09 00.59.11] Rebuilding and Verifying Blobs DB structure...
[2026-07-09 00.59.11] Rebuilding pristine indexes from source schema...
[2026-07-09 00.59.11] Rebuilding FTS Virtual Tables for ...

[2026-07-09 00.59.11] Executing file swap for completed pipelines...
[2026-07-09 00.59.11] Swap complete. Live databases updated.
[2026-07-09 00.59.11]  
[2026-07-09 00.59.11] Starting PMS.
[2026-07-09 00.59.11] Started PMS.
[2026-07-09 00.59.11]  
[2026-07-09 00.59.11] Deleting temporary work files.
chuck@tirol ~ % dbrepair/build/pc-darwin-arm64-release/bin/DBRepair                             
SYSTEM: macOS,(MacOS)
ENGINE: SQLite v3.53.0
STEEL:  ICU Headers LINKED
[Smoke Test Complete]
Binary Architecture: 64-bit




      Database Repair Utility for Plex Media Server  (MacOS)
                       Version 0.1999.01 (Jul  8 2026)


Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  5 - 'repair'    - Repair/Optimize databases.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : config
 

--- [ DBRepair: Host Configuration Dump ] ---

  Version:            [0.1999.01]
  Os                  [1]
  Uid / Gid           [501:20]
  Username            [chuck]
  Home Directory:     [/Users/chuck]
  Host Type:          [MacOS]
  Distro Name:        [macOS]
  Time Stamp:         [2026-07-09_00.59.59]
  Last User:          [None]
  Last Run:           [Never]

  Manual Config:      No
  Root Required:      No
  Scripted Mode:      No
  Ignore Errors:      No
  Checked DB:         No
  Damaged:            No
  Main Damaged:       No
  Blobs Damaged:      No
  Checked Main FTS:   No
  Main FTS Damaged:   No
  Checked Blobs FTS:  No
. Blobs FTS Damaged:  No
  Remove Duplicates:  No
  Fail Status:        No

  Owner UID/GID:      0:0
  Default Perms:      0644
  Stat Format:        [-f]
  Stat Bytes:         [%z]
  Stat Perms:         [%Lp]

  Package Dir:        [/Users/chuck//Applications/Plex Media Server.app]
  SQLite Version:     [3.53.0]
  App Support Dir:    [/Users/chuck/Library/Application Support]
  Database Dir:       [/Users/chuck/Library/Application Support/Plex Media Server/Plug-in Support/Databases]
  Database Temp Dir:  [/Users/chuck/Library/Application Support/Plex Media Server/Plug-in Support/Databases/dbtmp]
  Main DB Path:       [/Users/chuck/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db]
  Blobs DB Path:      [/Users/chuck/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db]
  Cache Dir:          [/Users/chuck/Library/Caches/PlexMediaServer/PhotoTranscoder]
  Log File:           [/Users/chuck/Library/Application Support/Plex Media Server/Plug-in Support/Databases/DBRepair.log]
  Pid File:           []
  Temp Dir (Local):   [/tmp]
  System Temp:        [/tmp]

  Script Name:        []
  Script Path:        []
  Working Dir:        []

  Sqlite3 Cache Size  [0]
  Sqlite3 Page Size   [0]
  DBRepair Notify Cmd []
 
  Pidof Utility:      [pgrep]
  FTS Query:          [SELECT name FROM sqlite_master WHERE sql LIKE '%FTS%';]
  Have Start/Stop:    (Yes)
  Start Command:      [TMPDIR=/tmp osascript -e 'tell app "Plex Media Server" to launch']
  Stop Command:       [TMPDIR=/tmp osascript -e 'tell app "Plex Media Server" to quit']
------------------------------------------------------


Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  5 - 'repair'    - Repair/Optimize databases.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : 

Deflating a 33 GB database on MacOS Arm64 (-v == verbose output)

chuck@tirol dbrepair % sudo build/pc-darwin-arm64-release/bin/DBRepair -v --databases ./databases stop config check repair exit
DEBUG: Setting H.CacheDir [./databases/../../Cache/PhotoTranscoder]
WARNING: Manual config provided. Cache directory (./databases/../../Cache/PhotoTranscoder) not found.
         Default Cache directory location cleared
SYSTEM: macOS,(MANUAL)
ENGINE: SQLite v3.53.0
STEEL:  ICU Headers LINKED
[Smoke Test Complete]
Binary Architecture: 64-bit




      Database Repair Utility for Plex Media Server  (MANUAL)
                       Version 0.1999.01 (Jul  8 2026)

[2026-07-09 01.04.53]       SQLite     = '3.53.0'
[2026-07-09 01.04.53]       Databases  = './databases'
[2026-07-09 01.04.53]  
[2026-07-09 01.04.53] Start/Stop feature not available.
[2026-07-09 01.04.53]  
[2026-07-09 01.04.53] 
--- [ DBRepair: Host Configuration Dump ] ---

[2026-07-09 01.04.53]   Version:            [0.1999.01]
[2026-07-09 01.04.53]   Os                  [1]
[2026-07-09 01.04.53]   Uid / Gid           [0:0]
[2026-07-09 01.04.53]   Username            [root]
[2026-07-09 01.04.53]   Home Directory:     [/Users/chuck]
[2026-07-09 01.04.53]   Host Type:          [MANUAL]
[2026-07-09 01.04.53]   Distro Name:        [macOS]
[2026-07-09 01.04.53]   Time Stamp:         [2026-07-09_01.04.53]
[2026-07-09 01.04.53]   Last User:          [None]
[2026-07-09 01.04.53]   Last Run:           [Never]
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]   Manual Config:      Yes
[2026-07-09 01.04.53]   Root Required:      No
[2026-07-09 01.04.53]   Scripted Mode:      Yes
[2026-07-09 01.04.53]   Ignore Errors:      No
[2026-07-09 01.04.53]   Checked DB:         No
[2026-07-09 01.04.53]   Damaged:            No
[2026-07-09 01.04.53]   Main Damaged:       No
[2026-07-09 01.04.53]   Blobs Damaged:      No
[2026-07-09 01.04.53]   Checked Main FTS:   No
[2026-07-09 01.04.53]   Main FTS Damaged:   No
[2026-07-09 01.04.53]   Checked Blobs FTS:  No
[2026-07-09 01.04.53] . Blobs FTS Damaged:  No
[2026-07-09 01.04.53]   Remove Duplicates:  No
[2026-07-09 01.04.53]   Fail Status:        No
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]   Owner UID/GID:      0:0
[2026-07-09 01.04.53]   Default Perms:      0644
[2026-07-09 01.04.53]   Stat Format:        [-c]
[2026-07-09 01.04.53]   Stat Bytes:         [%s]
[2026-07-09 01.04.53]   Stat Perms:         [%a]
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]   Package Dir:        []
[2026-07-09 01.04.53]   SQLite Version:     [3.53.0]
[2026-07-09 01.04.53]   App Support Dir:    []
[2026-07-09 01.04.53]   Database Dir:       [./databases]
[2026-07-09 01.04.53]   Database Temp Dir:  [./databases/dbtmp]
[2026-07-09 01.04.53]   Main DB Path:       [./databases/com.plexapp.plugins.library.db]
[2026-07-09 01.04.53]   Blobs DB Path:      [./databases/com.plexapp.plugins.library.blobs.db]
[2026-07-09 01.04.53]   Cache Dir:          []
[2026-07-09 01.04.53]   Log File:           [./databases/DBRepair.log]
[2026-07-09 01.04.53]   Pid File:           []
[2026-07-09 01.04.53]   Temp Dir (Local):   []
[2026-07-09 01.04.53]   System Temp:        []
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]   Script Name:        []
[2026-07-09 01.04.53]   Script Path:        []
[2026-07-09 01.04.53]   Working Dir:        []
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]   Sqlite3 Cache Size  [0]
[2026-07-09 01.04.53]   Sqlite3 Page Size   [0]
[2026-07-09 01.04.53]   DBRepair Notify Cmd []
[2026-07-09 01.04.53]  
[2026-07-09 01.04.53]   Pidof Utility:      [pidof]
[2026-07-09 01.04.53]   FTS Query:          [SELECT name FROM sqlite_master WHERE sql LIKE '%FTS%';]
[2026-07-09 01.04.53]   Have Start/Stop:    (No)
[2026-07-09 01.04.53]   Start Command:      []
[2026-07-09 01.04.53]   Stop Command:       []
[2026-07-09 01.04.53] ------------------------------------------------------
[2026-07-09 01.04.53] 
[2026-07-09 01.04.53]  
[2026-07-09 01.04.53] Checking the PMS databases...
[2026-07-09 01.16.01] Database is damaged: row 1202 missing from index index_title_sort_icu
[2026-07-09 01.16.01]   Main DB: FTS shadow table missing: 'fts4_metadata_titles_content'
[2026-07-09 01.16.01]   Main DB: FTS shadow table missing: 'fts4_tag_titles_content'
[2026-07-09 01.16.01]   Main DB: FTS shadow table missing: 'fts4_metadata_titles_icu_content'
[2026-07-09 01.16.01]   Main DB: FTS shadow table missing: 'fts4_tag_titles_icu_content'
[2026-07-09 01.16.01]   PMS main database is damaged.
[2026-07-09 01.16.02]   Blobs DB: FTS shadow table missing: 'fts4_metadata_titles_content'
[2026-07-09 01.16.02]   Blobs DB: FTS shadow table missing: 'fts4_tag_titles_content'
[2026-07-09 01.16.02]   Blobs DB: FTS shadow table missing: 'fts4_metadata_titles_icu_content'
[2026-07-09 01.16.02]   Blobs DB: FTS shadow table missing: 'fts4_tag_titles_icu_content'
[2026-07-09 01.16.02]   PMS blobs database is damaged.
[2026-07-09 01.16.02] 
[2026-07-09 01.16.02]   Main DB: FTS index 'spellfix_metadata_titles' - OK
[2026-07-09 01.16.02]   Main DB: FTS index 'spellfix_tag_titles' - OK
[2026-07-09 01.16.02]   Main DB: FTS index 'fts4_metadata_titles' - OK
[2026-07-09 01.16.02]   Main DB: FTS index 'fts4_tag_titles' - OK
[2026-07-09 01.16.02]   Main DB: FTS index 'fts4_metadata_titles_icu' - OK
[2026-07-09 01.16.03]   Main DB: FTS index 'fts4_tag_titles_icu' - OK
[2026-07-09 01.16.03]   Blobs DB: Missing FTS index 'locations' - MISSING
[2026-07-09 01.16.03]   Blobs DB: FTS index 'spellfix_metadata_titles' - OK
[2026-07-09 01.16.03]   Blobs DB: FTS index 'spellfix_tag_titles' - OK
[2026-07-09 01.16.03]   Blobs DB: FTS index 'fts4_metadata_titles' - OK
[2026-07-09 01.16.03]   Blobs DB: FTS index 'fts4_tag_titles' - OK
[2026-07-09 01.16.03]   Blobs DB: FTS index 'fts4_metadata_titles_icu' - OK
[2026-07-09 01.16.03]   Blobs DB: FTS index 'fts4_tag_titles_icu' - OK
[2026-07-09 01.16.03] 
[2026-07-09 01.16.03]   NOTE: FTS indexes are damaged but main database structure is OK.
[2026-07-09 01.16.03]         Use 'reindex' (option 6) or 'automatic' (option 2) to rebuild.
[2026-07-09 01.16.03] Checking the PMS databases... complete.
[2026-07-09 01.16.03]  
[2026-07-09 01.16.03] --- Processing Main DB ---
[2026-07-09 01.16.03] [Bulk] Extracting schema_migrations: 431 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting media_parts: 49091 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting library_sections: 24 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting section_locations: 61 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting directories: 3401 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting stream_types: 3 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting metadata_item_views: 9588 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting plugins: 13 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting plugin_prefixes: 2 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting tags: 131575 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting taggings: 404984 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting metadata_relations: 16249 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting metadata_item_settings: 12113 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting accounts: 23 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting media_part_settings: 1448 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting media_streams: 108759 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting media_items: 49091 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting metadata_items: 25898 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting play_queue_items: 2071 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting play_queues: 162 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting play_queue_generators: 164 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting metadata_item_accounts: 8 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting preferences: 15 rows completed.   
[2026-07-09 01.16.03] [Bulk] Extracting devices: 484 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting statistics_bandwidth: 24513 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting statistics_media: 6800 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting locations_node: 1 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting external_metadata_sources: 1 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting external_metadata_items: 190 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting media_stream_settings: 171 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting hub_templates: 25 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting activities: 90004 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting metadata_agent_providers: 5 rows completed.   
[2026-07-09 01.16.33] [Bulk] Extracting download_queues: 3 rows completed.   
[2026-07-09 01.16.34] Rebuilding and Verifying Main DB structure...
[2026-07-09 01.16.34] Rebuilding pristine indexes from source schema...
[2026-07-09 01.16.34] Rebuilding FTS Virtual Tables for ...

[2026-07-09 01.16.37] --- Processing Blobs DB ---
[2026-07-09 01.16.37] [Bulk] Extracting schema_migrations: 427 rows completed.   
[2026-07-09 01.16.37] [Bulk] Extracting stream_types: 3 rows completed.   
[2026-07-09 01.16.37] [Bulk] Extracting accounts: 1 rows completed.   
[2026-07-09 01.16.37] [Bulk] Extracting preferences: 1 rows completed.   
[2026-07-09 01.16.37] [Bulk] Extracting locations_node: 1 rows completed.   
[2026-07-09 01.16.37] [Bulk] Extracting blobs: 13399 rows completed.   
[2026-07-09 01.16.37] Rebuilding and Verifying Blobs DB structure...
[2026-07-09 01.16.37] Rebuilding pristine indexes from source schema...
[2026-07-09 01.16.37] Rebuilding FTS Virtual Tables for ...

[2026-07-09 01.16.37] Executing file swap for completed pipelines...
[2026-07-09 01.16.37] Swap complete. Live databases updated.
[2026-07-09 01.16.37]  
[2026-07-09 01.16.37] Deleting temporary work files.
chuck@tirol dbrepair %