Jump to content

Library Database cleanup utility


Go to solution Solved by riothamus,

Recommended Posts

I would like to request a library DB cleanup tool/utility within Emby. Seems a lot of missing, old, and duplicate entries cause many of the users issues. Especially if you move or change entire libraries. And I know the DB can grow to an unnecessary large size assuming a lot of waste in there. My library DB alone is over 1GB in size.


I have seen users post 'cleanup the DB' never stating how or where to find this utility. Seems to me that a lot of issues on this forum can easily be solved this way.


Can even be a plugin, I guess, if some savvy user wants to take it on.

Edited by dcol
Link to comment
Share on other sites

  • Solution

This basically does exist, just not in a very easy to find manner:




I do agree that a check-mark box or something would be handy.


Many of us just use a cron-job or some other mechanism to fire this process off.  As an example, here is my script that I have in /etc/cron.monthly:


ls -lh /var/lib/emby/data/library.db > /root/emby-db-clean.txt
systemctl stop emby-server.service
xmlstarlet ed --update "/ServerConfiguration/VacuumDatabaseOnStartup" --value true /var/lib/emby/config/system.xml 
systemctl start emby-server.service
sleep 30
ls -lh /var/lib/emby/data/library.db >> /root/emby-db-clean.txt
Edited by riothamus
  • Like 1
Link to comment
Share on other sites

Thanks @@riothamus , but I use Windows.


Ok found it

system.xml file and set VacuumDatabaseOnStartup to true

Edited by dcol
Link to comment
Share on other sites

Ran it. Took 20 seconds before log showed 'Info App: Core startup complete' reduced DB from 980MB to 530MB.


Probably a good thing to use when you make major library changes like reorganizing folder structures.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...