# DBRepair development

**URL:** <https://forums.plex.tv/t/dbrepair-development/822684>\
**Category:** Apps & Creations\
**Created:** [December 14, 2022, 3:57am UTC](https://forums.plex.tv/t/dbrepair-development/822684 "2022-12-14T03:57:23Z")\
**Posts on this page:** 20\
**Page:** 31

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2025, 1:35am UTC](https://forums.plex.tv/t/dbrepair-development/822684/656 "2025-05-24T01:35:09Z")

</div>

I coulda’ told ya that!

🤣

---

<div class="post-metadata">

**Author:** ![SE56](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/se56/32/222425_2.png) [@SE56](https://forums.plex.tv/u/SE56)\
**Post date:** [May 24, 2025, 1:36am UTC](https://forums.plex.tv/t/dbrepair-development/822684/657 "2025-05-24T01:36:51Z")

</div>

All good. ✅ 🫡

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2025, 1:40am UTC](https://forums.plex.tv/t/dbrepair-development/822684/658 "2025-05-24T01:40:39Z")

</div>

back up and running ?

---

<div class="post-metadata">

**Author:** ![hlve](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/hlve/32/225380_2.png) [@hlve](https://forums.plex.tv/u/hlve)\
**Post date:** [May 24, 2025, 6:39am UTC](https://forums.plex.tv/t/dbrepair-development/822684/659 "2025-05-24T06:39:16Z")

</div>

Any chance you can update `DBRepair-Windows.ps1` with this fix for us Windows users? 🙂

Thank you for the hard work you put into this.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2025, 7:18am UTC](https://forums.plex.tv/t/dbrepair-development/822684/660 "2025-05-24T07:18:23Z")

</div>

I have asked Dan (the user who maintains the Windows PS1 version to look into it.

What little I know of Windows, A modification to the BAT file should be this.  
( Line 97 )

 ![Screenshot from 2025-05-24 03-19-54](https://global.discourse-cdn.com/plex/original/4X/9/7/9/979485d81b886c3adcb1cc6f4978c0859445c0af.png)

```auto
echo %time% -- Deleting records
"%PlexSQL%" "%PlexData%\com.plexapp.plugins.library.db" "DELETE from statistics_bandwidth where account_id is NULL;"

```

It can take a few minutes for this to run (bloat, CPU, and whether SSD/HDD dependent)

Make 100% certain PMS is stopped.

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 24, 2025, 6:33pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/661 "2025-05-24T18:33:17Z")

</div>

My plex database is now so large that I haven’t enough space on my mac mini to make an automatic action of DBRepair now (I have the error message : not enough space) . Could you help me ?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2025, 7:20pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/662 "2025-05-24T19:20:21Z")

</div>

@Suramen

When you look in the Databases folder/directory, is there at lease one database backup you could delete or move elsewhere for now ?

If so, move it / them for now. Any backups of the bloated DBs should be discarded unless that’s all you have. In this case, move the backups so you have space again.

Next, run the script and let it do the cleanup. Be advised, if your DB is extremely large, it might take a few hours. ( reports vary from minutes to hours )

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 24, 2025, 9:34pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/663 "2025-05-24T21:34:26Z")

</div>

I can see that on plex database directory :

 ![Capture d’écran 2025-05-24 à 23.32.02](https://global.discourse-cdn.com/plex/original/4X/8/1/9/81906e42e6bf1fc814897f00911163df39749757.jpeg)  
what can I remove before doing the repair ?  
thank for your help

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2025, 10:25pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/664 "2025-05-24T22:25:04Z")

</div>

Would you be OK with deleting this database and using the backup?  
All you would need to do, after deleting and switching files, is to Scan Files and Refresh Metadata to make it current again.

Your last backup is May 15. (which was some time ago).  
We would be resetting your PMS to that date.

**NOTE** You can safely delete the contents of `dbtmp`. This should be done after every DBRepair run to avoid wasting space.

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 25, 2025, 5:31pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/665 "2025-05-25T17:31:08Z")

</div>

It took me a long time but I did all tasks you suggest (use the db backup, scan files, refresh metadata). My database is now 780 M after automatic DB Repair, coming from 61,55 Go ! Everything is fluid. Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 25, 2025, 6:13pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/666 "2025-05-25T18:13:13Z")

</div>

@Suramen

Now that you’ve recovered, you can delete the bloated DB copies / backups if you wish then make a backup of the current ones.

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 25, 2025, 6:22pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/667 "2025-05-25T18:22:46Z")

</div>

Done. Thanks a lot

---

<div class="post-metadata">

**Author:** ![flipster](https://avatars.discourse-cdn.com/v4/letter/f/858c86/32.png) [@flipster](https://forums.plex.tv/u/flipster)\
**Post date:** [May 26, 2025, 9:37am UTC](https://forums.plex.tv/t/dbrepair-development/822684/668 "2025-05-26T09:37:12Z")

</div>

Worked like a charm with plex docker. The automated session reduced the DB from 50GB to 50 MB and took about 48 hours on a slower HDD.

I couldn’t find any link to buy you a coffee, let me know, if there’s a way

Best

---

<div class="post-metadata">

**Author:** ![SE56](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/se56/32/222425_2.png) [@SE56](https://forums.plex.tv/u/SE56)\
**Post date:** [May 26, 2025, 4:01pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/670 "2025-05-26T16:01:40Z")

</div>

Could be wrong but always thought that belonged to `Plex for Mac` for me.

After restart it just repopulated In application support.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 26, 2025, 4:16pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/671 "2025-05-26T16:16:07Z")

</div>

On DSM 6, we used the `Plex` shared folder.  
When DSM 7 came out, we were forced to change

- Username `plex` → System Internal User `PlexMediaServer`
- Shared Folder `Plex` → Shared Folder `PlexMediaServer`

When you first installed / upgraded PMS after upgrading to DSM 7,  
it was supposed to bring over your entire DSM 6 server’s internal contents  
(this is what normally lives in `Library/Application Support/Plex Media Server`) so you didn’t lose any server data.

If that didn’t happen and you had to start over (all of DSM 6 was abandoned)  
then

1. User `Plex` can be deleted
2. Shared Folder `Plex` can be deleted (or minimally cleaned out) unless you have a use for it.

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 26, 2025, 4:16pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/672 "2025-05-26T16:16:44Z")

</div>

exact, I delete it and post to Synology

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 26, 2025, 4:21pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/673 "2025-05-26T16:21:37Z")

</div>

clear. I do that. thanks a lot

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 26, 2025, 7:01pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/674 "2025-05-26T19:01:59Z")

</div>

Try now to use DB Repair on my Plex Server running on Synology 1019+ with DSM7.  
I follow instructions :  
Install the rar file in Plex Media Server folder  
then terminal with my mac :  
cd /volume1/PlexMediaServer  
sudo bash  
bash-4.4# tar xf DBRepair-1.11.00.tar.gz  
tar: DBRepair-1.11.00.tar.gz: Cannot open: No such file or directory  
tar: Error is not recoverable: exiting now

So I have an error  
Could you help me ?

---

<div class="post-metadata">

**Author:** ![FordGuy61](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@FordGuy61](https://forums.plex.tv/u/FordGuy61)\
**Post date:** [May 26, 2025, 7:57pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/675 "2025-05-26T19:57:47Z")

</div>

@Suramen

`.gz` means the file is compressed.

Try `tar xzf DBRepair-1.11.00.tar.gz`

The `z` flag tells tar to uncompress with `gzip`.

  

If that does not work:

Login to the Syno via SSH.

```auto
# change to the PlexMediaServer directory
cd /volume1/PlexMediaServer

# download DBRepair.sh, -O means overwrite an existing file if one is present.
sudo wget -O DBRepair.sh https://github.com/ChuckPa/DBRepair/releases/latest/download/DBRepair.sh

# make it executable
sudo chmod a+x DBRepair.sh

# run it
sudo ./DBRepair.sh

```

---

<div class="post-metadata">

**Author:** ![Suramen](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/suramen/32/307147_2.png) [@Suramen](https://forums.plex.tv/u/Suramen)\
**Post date:** [May 27, 2025, 2:56pm UTC](https://forums.plex.tv/t/dbrepair-development/822684/676 "2025-05-27T14:56:21Z")

</div>

Worked fine with the second scenario. Automatic DBRepair done. everything is fluid. Many thanks for your help.

[Previous page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=30)

[Next page](https://forums.plex.tv/t/dbrepair-development/822684.md?page=32)
