These instructions apply to Subsonic 4.7 running on a RedHat variant Linux
If, in the course of using Subsonic, the DB becomes corrupted and you begin seeing problems, you can retain your settings and clear the database to resolve the issue.
I was getting errors like “org.springframework.dao.TransientDataAccessResourceException” and “java.sql.SQLException: S1000 General error java.lang.NullPointerException in statement” because my “media_file” table had somehow gone missing.
- Stop Subsonic
- “service subsonic stop”
- Backup your /var/subsonic/db/subsonic.script file
- This file contains a handful of SQL statements that will be used later to recreate your users, media directory settings, etc.
- “cp /var/subsonic/db/subsonic.script /root/”
- Delete the contents of your /var/subsonic/db/ directory
- “rm /var/subsonic/db/*”
- Restore your subsonic.script file
- “cp /root/subsonic.script /var/subsonic/db/”
- Start Subsonic
- “service subsonic start”
- In that your media library will now be empty, you’ll want to go to “Settings…” “Media Folders…” and click “Scan media folders now”
- To validate that there was something wrong with the database, I went to the direct database web UI for subsonic by browsing to http://example.subsonic.org/db.view
- From within the db.view interface you can run queries directly. I ran “select * from media_file” and found that there was no media_file table.