Hello,
I’ve just migrated my PMS v1.3.4 from a CentOS v7.3 to other CentOS v7.3 and when I try to optimize the database I’m getting this error:
Feb 28, 2017 10:13:12.590 [0x7f3890bfe700] ERROR - SQLITE3:0x10, 1, statement aborts at 33: [insert into fts4_tag_titles(rowid, tag) select id, tag from tags where tag_type in (1,4,6)] SQL logic error or missing database
Feb 28, 2017 10:13:12.592 [0x7f3890bfe700] ERROR - Exception inside transaction (inside=1) (…/Library/FullTextSearch.cpp:35): sqlite3_statement_backend::loadOne: SQL logic error or missing database
Feb 28, 2017 10:13:12.599 [0x7f3890bfe700] ERROR - Soci Exception handled: sqlite3_statement_backend::loadOne: SQL logic error or missing database
Except that everything is working fine but I’m unable to optimize the db.
Here are the steps performed till now:
PRAGMA integrity_check -> ok
dump on com.plexapp.plugins.library.db and loaded from the dumped file (removed also the *-shm and *-wal)
upgraded to PMS v1.4.2, same issue. Downgraded back to v1.3.4, same issue.
Any idea what is causing this ?
Thanks!
Perhaps you tried to copy the database file when the source and/or the destination Plex server was still running? If so, you copied a damaged database.
Try the restoration procedure for one of the database backups.
Thanks @OttoKerner . I’ve performed a mass update and I want to avoid restoring from backup.
Maybe I can find a quick fix for this.
Performed a database restore and the issue is fixed. I’ll scan it again to have ti accurate 
Thank you @OttoKerner !
@shocker-live said:
Performed a database restore and the issue is fixed. I’ll scan it again to have ti accurate 
Perform the repair again, just to be sure the damage is not already slumbering in there.
Here are updated commands for repairing the database
Linux
-----
sqlite3 "$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" "PRAGMA integrity_check"
sqlite3 "$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" .dump > dump.sql
mv "$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" "$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db.original"
sqlite3 "$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" < dump.sql
Already performed this and everything is ok. Thanks.