Thursday, June 28, 2018

Fix malformed SQLite DB in Tautuli (PlexPy) server in Windows


For those running Tautuli to monitor their Plex servers, sometimes DB issues happen. After upgrading from PlexPy to Tautuli I never had a solid footing on strange issues until I found a DB error and fixed it.

I kept seeing the following error in the logs:

Can't connect to the database: database disk image is malformed

To fix this, it's pretty simple. First you will need DB Browser for SQLite. The portable app works just fine if you don't want to install anything.

(if you need a more graphical guide, look at http://wordpress.semnaitik.com/repair-sqlite-database/ where I got most this info from)

Copy the tautuli.db file out of your plexpy/tautuli directory to work on.

In DB Browser for SQLite, click Open Database.

Execute SQL (tab)

Run the following: PRAGMA integrity_check

Then click the Play button.

You will see errors if there are DB issues (if the integrity check passes, it's not DB related).

Export the DB to SQL format and leave all the default options checked.

Once the database export is complete, import the database. This will essentially "clean" it. It will take some time to import

Import the database and select a new file name/location to store it. Replace this database with your main Tautuli database and relaunch the app.