mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-12-05 17:02:32 -05:00
Compare commits
6 Commits
d79b5e2b9d
...
v1.13.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbd02cc6b6 | ||
|
|
43d636b371 | ||
|
|
85c88a59f3 | ||
|
|
f2060a0ede | ||
|
|
abc552fb12 | ||
|
|
aa76cbfefd |
19
DBRepair.sh
19
DBRepair.sh
@@ -2,12 +2,12 @@
|
|||||||
#########################################################################
|
#########################################################################
|
||||||
# Database Repair Utility for Plex Media Server. #
|
# Database Repair Utility for Plex Media Server. #
|
||||||
# Maintainer: ChuckPa #
|
# Maintainer: ChuckPa #
|
||||||
# Version: v1.12.00 #
|
# Version: v1.13.01 #
|
||||||
# Date: 06-Oct-2025 #
|
# Date: 14-Nov-2025 #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# Version for display purposes
|
# Version for display purposes
|
||||||
Version="v1.12.00"
|
Version="v1.13.01"
|
||||||
|
|
||||||
# Have the databases passed integrity checks
|
# Have the databases passed integrity checks
|
||||||
CheckedDB=0
|
CheckedDB=0
|
||||||
@@ -779,10 +779,15 @@ HostConfig() {
|
|||||||
LOGFILE="$DBDIR/DBRepair.log"
|
LOGFILE="$DBDIR/DBRepair.log"
|
||||||
LOG_TOOL="logger"
|
LOG_TOOL="logger"
|
||||||
|
|
||||||
if grep rpcinterface /etc/supervisor.conf > /dev/null; then
|
if [ -e /etc/supervisor.conf ] && grep rpcinterface /etc/supervisor.conf > /dev/null; then
|
||||||
HaveStartStop=1
|
HaveStartStop=1
|
||||||
StartCommand="supervisorctl start plexmediaserver"
|
StartCommand="supervisorctl start plexmediaserver"
|
||||||
StopCommand="supervisorctl stop plexmediaserver"
|
StopCommand="supervisorctl stop plexmediaserver"
|
||||||
|
|
||||||
|
elif [ -e /etc/supervisord.conf ] && grep rpcinterface /etc/supervisord.conf > /dev/null; then
|
||||||
|
HaveStartStop=1
|
||||||
|
StartCommand="supervisorctl start start-script"
|
||||||
|
StopCommand="supervisorctl stop start-script"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HostType="BINHEX"
|
HostType="BINHEX"
|
||||||
@@ -1448,7 +1453,7 @@ DoDeflate() {
|
|||||||
|
|
||||||
# Inform user
|
# Inform user
|
||||||
Output "Starting Deflate (Part 1 of 2 - Repair database table)"
|
Output "Starting Deflate (Part 1 of 2 - Repair database table)"
|
||||||
Output " This should take approx $((DBSize / 2)) minutes but is I/O speed dependent"
|
Output "Estimated completion is $((DBSize / 3)) minutes but is CPU & I/O speed dependent"
|
||||||
Output ""
|
Output ""
|
||||||
WriteLog "Deflate - Start Deflate Pass 1"
|
WriteLog "Deflate - Start Deflate Pass 1"
|
||||||
|
|
||||||
@@ -1886,7 +1891,7 @@ DoUpdateTimestamp() {
|
|||||||
GetLatestRelease() {
|
GetLatestRelease() {
|
||||||
Response=$(curl -sL "https://api.github.com/repos/ChuckPa/DBRepair/tags")
|
Response=$(curl -sL "https://api.github.com/repos/ChuckPa/DBRepair/tags")
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
LatestVersion="$(echo "$Response" | grep name | awk -F: '{print $2}' | sort -r | head -1 | tr -d \" | tr -d ' ' | tr -d ',')"
|
LatestVersion="$(echo "$Response" | grep name | awk -F: '{print $2}' | sort -rn | head -1 | tr -d \" | tr -d ' ' | tr -d ',')"
|
||||||
else
|
else
|
||||||
LatestVersion="$Version"
|
LatestVersion="$Version"
|
||||||
fi
|
fi
|
||||||
@@ -2194,13 +2199,11 @@ do
|
|||||||
echo " 10 - 'show' - Show logfile."
|
echo " 10 - 'show' - Show logfile."
|
||||||
echo " 11 - 'status' - Report status of PMS (run-state and databases)."
|
echo " 11 - 'status' - Report status of PMS (run-state and databases)."
|
||||||
echo " 12 - 'undo' - Undo last successful command."
|
echo " 12 - 'undo' - Undo last successful command."
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " 21 - 'prune' - Remove old image files from PhotoTranscoder cache & all temp files left by PMS."
|
echo " 21 - 'prune' - Remove old image files from PhotoTranscoder cache & all temp files left by PMS."
|
||||||
echo " 23 - 'deflate' - Deflate a bloated PMS main database."
|
echo " 23 - 'deflate' - Deflate a bloated PMS main database."
|
||||||
[ $IgnoreErrors -eq 0 ] && echo " 42 - 'ignore' - Ignore duplicate/constraint errors."
|
[ $IgnoreErrors -eq 0 ] && echo " 42 - 'ignore' - Ignore duplicate/constraint errors."
|
||||||
[ $IgnoreErrors -eq 1 ] && echo " 42 - 'honor' - Honor all database errors."
|
[ $IgnoreErrors -eq 1 ] && echo " 42 - 'honor' - Honor all database errors."
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " 88 - 'update' - Check for updates."
|
echo " 88 - 'update' - Check for updates."
|
||||||
echo " 98 - 'quit' - Quit immediately. Keep all temporary files."
|
echo " 98 - 'quit' - Quit immediately. Keep all temporary files."
|
||||||
|
|||||||
108
README.md
108
README.md
@@ -31,6 +31,7 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
|||||||
```
|
```
|
||||||
AUTO(matic) - Automatically check, repair/optimize, and reindex the databases in one step.
|
AUTO(matic) - Automatically check, repair/optimize, and reindex the databases in one step.
|
||||||
CHEC(k) - Check the main and blob databases integrity
|
CHEC(k) - Check the main and blob databases integrity
|
||||||
|
DEFL(ate) - Deflate a bloated PMS database (faulty statistics data)
|
||||||
EXIT - Exit the utility
|
EXIT - Exit the utility
|
||||||
IGNOre/HONOr - Ignore/Honor constraint errors when IMPORTing additional data into DB.
|
IGNOre/HONOr - Ignore/Honor constraint errors when IMPORTing additional data into DB.
|
||||||
IMPO(rt) - Import viewstate / watch history from another database
|
IMPO(rt) - Import viewstate / watch history from another database
|
||||||
@@ -72,6 +73,7 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
|||||||
|
|
||||||
21 - 'prune' - Prune (remove) old image files (jpeg,jpg,png) from PhotoTranscoder cache.
|
21 - 'prune' - Prune (remove) old image files (jpeg,jpg,png) from PhotoTranscoder cache.
|
||||||
22 - 'purge' - Purge (delete) all temporary files left behind by PMS & the transcoder.
|
22 - 'purge' - Purge (delete) all temporary files left behind by PMS & the transcoder.
|
||||||
|
23 - 'deflate' - Deflate a bloated PMS main database.
|
||||||
42 - 'ignore' - Ignore duplicate/constraint errors.
|
42 - 'ignore' - Ignore duplicate/constraint errors.
|
||||||
|
|
||||||
88 - 'update' - Check for updates.
|
88 - 'update' - Check for updates.
|
||||||
@@ -226,18 +228,18 @@ These examples
|
|||||||
3. (6) Reindex - Generate new indexes so PMS doesn't need to at startup
|
3. (6) Reindex - Generate new indexes so PMS doesn't need to at startup
|
||||||
4. (99) Exit
|
4. (99) Exit
|
||||||
|
|
||||||
C. Database sizes excessively large/bloated when compared to amount of media indexed (item count)
|
D. Database sizes excessively large/bloated when compared to amount of media indexed (item count)
|
||||||
1. (23) Deflate - Correct the known problem with a database table and recover the wasted space.
|
1. (23) Deflate - Correct the known problem with a database table and recover the wasted space.
|
||||||
2. (2) Auto - Perform automated check, repair, and reindex of the deflated database
|
2. (2) Auto - Perform automated check, repair, and reindex of the deflated database
|
||||||
4. (99) Exit
|
4. (99) Exit
|
||||||
|
|
||||||
D. User interface has become 'sluggish' as more media was added
|
E. User interface has become 'sluggish' as more media was added
|
||||||
1. (3) Check - Confirm there is no database damage
|
1. (3) Check - Confirm there is no database damage
|
||||||
2. (5) Repair - You are not really repairing. You are rebuilding the DB in perfect sorted order.
|
2. (5) Repair - You are not really repairing. You are rebuilding the DB in perfect sorted order.
|
||||||
3. (6) Reindex - Rebuild Indexes.
|
3. (6) Reindex - Rebuild Indexes.
|
||||||
4. (99) Exit
|
4. (99) Exit
|
||||||
|
|
||||||
E. Undo
|
F. Undo
|
||||||
Undo is a special case where you need the utility to backup ONE step.
|
Undo is a special case where you need the utility to backup ONE step.
|
||||||
This is rarely needed. The only time you might want/need to backup one step is if Replace leaves you worse off
|
This is rarely needed. The only time you might want/need to backup one step is if Replace leaves you worse off
|
||||||
than you were before. In this case, UNDO then Repair. Undo can only undo the single most-recent action.
|
than you were before. In this case, UNDO then Repair. Undo can only undo the single most-recent action.
|
||||||
@@ -829,55 +831,77 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases#
|
|||||||
1. Remove the environment variable.
|
1. Remove the environment variable.
|
||||||
2. Run DBRepair again using "automatic". Your databases will revert to the host OS's default.
|
2. Run DBRepair again using "automatic". Your databases will revert to the host OS's default.
|
||||||
|
|
||||||
### Usage: (Linux example shown)
|
### Usage: (QNAP example shown)
|
||||||
|
|
||||||
```
|
```
|
||||||
# export DBREPAIR_PAGESIZE=65534
|
# export DBREPAIR_PAGESIZE=65534
|
||||||
# ./DBRepair.sh stop auto start exit
|
# ./DBRepair.sh stop deflate auto start exit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Database Repair Utility for Plex Media Server (Ubuntu 22.04.3 LTS)
|
Database Repair Utility for Plex Media Server (QNAP)
|
||||||
Version v1.03.01
|
Version v1.12.00
|
||||||
|
|
||||||
|
|
||||||
[2024-01-14 17.25.35] Stopping PMS.
|
[2025-10-21 16.54.00] PMS already stopped.
|
||||||
[2024-01-14 17.25.35] Stopped PMS.
|
|
||||||
|
|
||||||
[2024-01-14 17.25.35] Automatic Check,Repair,Index started.
|
[2025-10-21 16.54.00] Check and Deflate started.
|
||||||
[2024-01-14 17.25.35]
|
[2025-10-21 16.54.00]
|
||||||
[2024-01-14 17.25.35] Checking the PMS databases
|
[2025-10-21 16.54.00] Checking the PMS databases
|
||||||
[2024-01-14 17.25.48] Check complete. PMS main database is OK.
|
[2025-10-21 16.54.19] Check complete. PMS main database is OK.
|
||||||
[2024-01-14 17.25.48] Check complete. PMS blobs database is OK.
|
[2025-10-21 16.54.21] Check complete. PMS blobs database is OK.
|
||||||
[2024-01-14 17.25.48]
|
[2025-10-21 16.54.21]
|
||||||
[2024-01-14 17.25.48] Exporting current databases using timestamp: 2024-01-14_17.25.35
|
[2025-10-21 16.54.21] Backup current databases with '-BACKUP-2025-10-21_16.54.21' timestamp.
|
||||||
[2024-01-14 17.25.48] Exporting Main DB
|
[2025-10-21 16.56.29] Starting Deflate (Part 1 of 2 - Repair database table)
|
||||||
[2024-01-14 17.25.59] Exporting Blobs DB
|
[2025-10-21 16.56.29] Estimated completion is approx 6 minutes but is CPU & I/O speed dependent
|
||||||
[2024-01-14 17.26.00] Successfully exported the main and blobs databases. Proceeding to import into new databases.
|
[2025-10-21 16.56.29]
|
||||||
[2024-01-14 17.26.00] Importing Main DB.
|
[2025-10-21 16.56.30] PMS main database successfully repaired.
|
||||||
[2024-01-14 17.26.00] Setting Plex SQLite page size (65536)
|
[2025-10-21 16.56.30] Starting Deflate (Part 2 of 2 - Reduce size)
|
||||||
[2024-01-14 17.26.29] Importing Blobs DB.
|
[2025-10-21 16.56.35] PMS main database size reduced.
|
||||||
[2024-01-14 17.26.29] Setting Plex SQLite page size (65536)
|
[2025-10-21 16.56.35] Verifying PMS main database.
|
||||||
[2024-01-14 17.26.30] Successfully imported databases.
|
[2025-10-21 16.56.50] Verification complete. PMS main database is OK.
|
||||||
[2024-01-14 17.26.30] Verifying databases integrity after importing.
|
[2025-10-21 16.56.50] PMS main database reduced from 31586 MB to 206 MB
|
||||||
[2024-01-14 17.27.43] Verification complete. PMS main database is OK.
|
[2025-10-21 16.56.51] Saving current main database with '-BLOATED-2025-10-21_16.54.21'
|
||||||
[2024-01-14 17.27.43] Verification complete. PMS blobs database is OK.
|
[2025-10-21 16.56.51] Making deflated database active
|
||||||
[2024-01-14 17.27.43] Saving current databases with '-BACKUP-2024-01-14_17.25.35'
|
[2025-10-21 16.56.51] PMS main database deflate completed.
|
||||||
[2024-01-14 17.27.43] Making repaired databases active
|
[2025-10-21 16.56.51] Deflate successful.
|
||||||
[2024-01-14 17.27.43] Repair complete. Please check your library settings and contents for completeness.
|
[2025-10-21 16.56.51] Recommend running Auto next to complete optimization of new database.
|
||||||
[2024-01-14 17.27.43] Recommend: Scan Files and Refresh all metadata for each library section.
|
|
||||||
[2024-01-14 17.27.43]
|
|
||||||
[2024-01-14 17.27.43] Backing up of databases
|
|
||||||
[2024-01-14 17.27.43] Backup current databases with '-BACKUP-2024-01-14_17.27.43' timestamp.
|
|
||||||
[2024-01-14 17.27.44] Reindexing main database
|
|
||||||
[2024-01-14 17.28.08] Reindexing main database successful.
|
|
||||||
[2024-01-14 17.28.08] Reindexing blobs database
|
|
||||||
[2024-01-14 17.28.08] Reindexing blobs database successful.
|
|
||||||
[2024-01-14 17.28.08] Reindex complete.
|
|
||||||
[2024-01-14 17.28.08] Automatic Check, Repair/optimize, & Index successful.
|
|
||||||
|
|
||||||
[2024-01-14 17.28.08] Starting PMS.
|
[2025-10-21 16.56.51] Automatic Check,Repair,Index started.
|
||||||
[2024-01-14 17.28.08] Started PMS
|
[2025-10-21 16.56.51]
|
||||||
|
[2025-10-21 16.56.51] Checking the PMS databases
|
||||||
|
[2025-10-21 16.57.04] Check complete. PMS main database is OK.
|
||||||
|
[2025-10-21 16.57.05] Check complete. PMS blobs database is OK.
|
||||||
|
[2025-10-21 16.57.05]
|
||||||
|
[2025-10-21 16.57.05] Exporting current databases using timestamp: 2025-10-21_16.56.51
|
||||||
|
[2025-10-21 16.57.05] Exporting Main DB
|
||||||
|
[2025-10-21 16.57.24] Exporting Blobs DB
|
||||||
|
[2025-10-21 16.59.18] Successfully exported the main and blobs databases.
|
||||||
|
[2025-10-21 16.59.18] Start importing into new databases.
|
||||||
|
[2025-10-21 16.59.18] Importing Main DB.
|
||||||
|
[2025-10-21 16.59.18] Setting Plex SQLite page size (65536)
|
||||||
|
[2025-10-21 17.00.19] Importing Blobs DB.
|
||||||
|
[2025-10-21 17.00.19] Setting Plex SQLite page size (65536)
|
||||||
|
[2025-10-21 17.00.32] Successfully imported databases.
|
||||||
|
[2025-10-21 17.00.32] Verifying databases integrity after importing.
|
||||||
|
[2025-10-21 17.01.59] Verification complete. PMS main database is OK.
|
||||||
|
[2025-10-21 17.02.01] Verification complete. PMS blobs database is OK.
|
||||||
|
[2025-10-21 17.02.01] Saving current databases with '-BACKUP-2025-10-21_16.56.51'
|
||||||
|
[2025-10-21 17.02.01] Making repaired databases active
|
||||||
|
[2025-10-21 17.02.01] Repair complete. Please check your library settings and contents for completeness.
|
||||||
|
[2025-10-21 17.02.01] Recommend: Scan Files and Refresh all metadata for each library section.
|
||||||
|
[2025-10-21 17.02.01]
|
||||||
|
[2025-10-21 17.02.01] Backing up of databases
|
||||||
|
[2025-10-21 17.02.01] Backup current databases with '-BACKUP-2025-10-21_17.02.01' timestamp.
|
||||||
|
[2025-10-21 17.02.02] Reindexing main database
|
||||||
|
[2025-10-21 17.02.13] Reindexing main database successful.
|
||||||
|
[2025-10-21 17.02.13] Reindexing blobs database
|
||||||
|
[2025-10-21 17.02.14] Reindexing blobs database successful.
|
||||||
|
[2025-10-21 17.02.14] Reindex complete.
|
||||||
|
[2025-10-21 17.02.14] Automatic Check, Repair/optimize, & Index successful.
|
||||||
|
|
||||||
|
[2025-10-21 17.02.14] Starting PMS.
|
||||||
|
[2025-10-21 17.02.14] Started PMS
|
||||||
|
|
||||||
#
|
#
|
||||||
```
|
```
|
||||||
|
|||||||
13
ReleaseNotes
13
ReleaseNotes
@@ -8,6 +8,19 @@
|
|||||||

|

|
||||||
|
|
||||||
# Release Info:
|
# Release Info:
|
||||||
|
v1.13.01
|
||||||
|
|
||||||
|
1. Tag sort order - Github tags are not guaranteed to be numeric or in most-recent order.
|
||||||
|
This update sorts version tags numerically and in reverse order to accommodate github shortcoming.
|
||||||
|
|
||||||
|
v1.13.00
|
||||||
|
|
||||||
|
1. Binhex containers - Add support for updated 'supervisord' start/stop control.
|
||||||
|
Maintain support for legacy 'supervisor' start/stop control.
|
||||||
|
|
||||||
|
This will be removed in the next release
|
||||||
|
Update your container before updating DBRepair.
|
||||||
|
|
||||||
v1.12.00
|
v1.12.00
|
||||||
|
|
||||||
1. Deflate capability - Deflate a bloated PMS main database and retain bandwidth statistics.
|
1. Deflate capability - Deflate a bloated PMS main database and retain bandwidth statistics.
|
||||||
|
|||||||
Reference in New Issue
Block a user