# Can no longer update library database with sqlite3

**URL:** <https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405>\
**Category:** Metadata & Adding Files\
**Tags:** server-linux, library-management\
**Created:** [March 18, 2021, 7:11am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405 "2021-03-18T07:11:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bevenhall](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@bevenhall](https://forums.plex.tv/u/bevenhall)\
**Post date:** [March 18, 2021, 7:11am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/1 "2021-03-18T07:11:13Z")

</div>

Server Version#: 1.22.1.4200  
Player Version#: N/A

I can no longer manually update the com.plexapp.plugins.library.db with sqlite3.  
Any attempt to edit the database exits with “Error: unknown tokenizer: collating”.  
Using a gui like sqlitebrowser produces a similar error.

(Libraries are updated ok when new content is added, btw.)

I just want to know how to get around the tokenizer error when manipulating the db from cli.  
Any hints?  
jim

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [March 18, 2021, 11:07pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/3 "2021-03-18T23:07:39Z")

</div>

The necessary magic to use Plex’s SQLite is here:

> [@Hoping for help with DB corruption](https://forums.plex.tv/t/hoping-for-help-with-db-corruption/701344/8):
>
> If I may help here? To invoke the resident SQLite3 module. "/usr/lib/plexmediaserver/Plex Media Server" --sqlite If you wish to go further in to Plex Media Server/Plug-in Support/Databases to save typing of the path, that’s fine. [/share/CACHEDEV3\_DATA/.qpkg/PlexMediaServer] # ./Plex\ Media\ Server --sqlite SQLite version 3.26.0 2018-12-01 12:34:55 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite\> Y…

* * *

I believe this is associated with improvements in how full-text searching is implemented.

There’s a new index, **index\_title\_sort\_icu**. And two new virtual full-text-search tables, **fts4\_metadata\_titles\_icu** and **fts4\_tag\_titles\_icu** - that’s where the **collating** add-on tokenizer is being used.

* * *

Things I haven’t tested:

I wonder if dropping **index\_title\_sort\_icu** and the **fts4\*icu** virtual tables and associated triggers would work, if done correctly. Similar to how the [Repair a Corrupt Database](https://support.plex.tv/articles/201100678-repair-a-corrupt-database/) instructions have you drop **index\_title\_sort\_naturalsort**.

There’s a big group of schema migrations associated with these. They all start with **500000000000** so it might be possible to do.

---

<div class="post-metadata">

**Author:** ![bevenhall](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@bevenhall](https://forums.plex.tv/u/bevenhall)\
**Post date:** [March 19, 2021, 7:32am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/4 "2021-03-19T07:32:04Z")

</div>

_This_

Exactly what I was looking for.  
Many Thanks!

jim

---

<div class="post-metadata">

**Author:** ![rp1989](https://avatars.discourse-cdn.com/v4/letter/r/74df32/32.png) [@rp1989](https://forums.plex.tv/u/rp1989)\
**Post date:** [March 22, 2021, 11:39am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/6 "2021-03-22T11:39:24Z")

</div>

Hello, would someone be able to provide details steps & commands to modify the added\_at after these new changes please? My server version is also 1.22.1.4200.

Thanks

---

<div class="post-metadata">

**Author:** ![bevenhall](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@bevenhall](https://forums.plex.tv/u/bevenhall)\
**Post date:** [March 22, 2021, 1:09pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/7 "2021-03-22T13:09:28Z")

</div>

Code snippet:

```auto
#!/bin/bash
SQLITE=/usr/lib/plexmediaserver/Plex\ Media\ Server
DB=./com.plexapp.plugins.library.db
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases
"$SQLITE" --sqlite $DB "UPDATE metadata_items SET added_at = datetime(originally_available_at, '+1 days') WHERE id like 'YOUR-XML-ID';"

```

Should be reasonably self-explanatory.

jim

---

<div class="post-metadata">

**Author:** ![mackatini](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mackatini](https://forums.plex.tv/u/mackatini)\
**Post date:** [March 22, 2021, 8:07pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/8 "2021-03-22T20:07:34Z")

</div>

Is there a way to do this on Windows?  
I’ve looked everywhere and can’t find any solutions to this. I also don’t see sqlite3.exe in any of the plex folders.

---

<div class="post-metadata">

**Author:** ![jay.woods](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jay.woods](https://forums.plex.tv/u/jay.woods)\
**Post date:** [March 24, 2021, 7:59pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/10 "2021-03-24T19:59:06Z")

</div>

I too am having issues. This was a great workaround to modify newly added, older movies. I now plan to halt any new additions to the library until I’m able to do this again. This changed immediately after Plex was recently updated. I’m using version 1.22.1.4228.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![jay.woods](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jay.woods](https://forums.plex.tv/u/jay.woods)\
**Post date:** [March 24, 2021, 8:00pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/11 "2021-03-24T20:00:36Z")

</div>

Can you explain how what @Volts said resolved your issue? Some of that looks greek to me.

---

<div class="post-metadata">

**Author:** ![Duff3](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Duff3](https://forums.plex.tv/u/Duff3)\
**Post date:** [March 25, 2021, 1:55pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/12 "2021-03-25T13:55:12Z")

</div>

I have edited my database using DB Browser for SQLite.

I edit it to add EAC3 7.1 channel for the audio source as Plex will only display EAC3 5.1, even when 8 channels are present in the source.

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [March 26, 2021, 6:15am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/13 "2021-03-26T06:15:50Z")

</div>

Plex is now using extensions to SQLite. So instead of the OS-provided SQLite program, you need to use the one built into Plex.

`/path/to/Plex\ Media\ Server --sqlite /path/to/com.plexapp.plugins.library.db`

---

<div class="post-metadata">

**Author:** ![Yaracuy](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/yaracuy/32/313162_2.png) [@Yaracuy](https://forums.plex.tv/u/Yaracuy)\
**Post date:** [March 26, 2021, 7:42am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/14 "2021-03-26T07:42:04Z")

</div>

In Windows, in Plex install dir, I can only see a `sqlite3_plex.dll` file but not a `sqlite3_plex.exe` or a `sqlite3.exe` file.

From time to time I run this procedure: [Repair a Corrupt Database | Plex Support](https://support.plex.tv/articles/201100678-repair-a-corrupt-database/)

How should I do it from now on?

---

<div class="post-metadata">

**Author:** ![mackatini](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@mackatini](https://forums.plex.tv/u/mackatini)\
**Post date:** [March 26, 2021, 8:30am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/15 "2021-03-26T08:30:16Z")

</div>

Exactly my question too.

---

<div class="post-metadata">

**Author:** ![Ferg\_Wh1te\_Yahoo.co.uk](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Ferg\_Wh1te\_Yahoo.co.uk](https://forums.plex.tv/u/Ferg_Wh1te_Yahoo.co.uk)\
**Post date:** [March 26, 2021, 12:59pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/17 "2021-03-26T12:59:21Z")

</div>

Have tried on Mac at command line, got an initial message about address in use. Shutdown the app, ran ./Plex\ Media\ Server\ --sqlite ‘library location of DB’ ‘UPDATE STATEMENT’ but which would not return any error messages but start up the server and not much else. Used to find being able to run the command within DB Browser For SQLite very useful to keep the library tidy.

---

<div class="post-metadata">

**Author:** ![Duff3](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Duff3](https://forums.plex.tv/u/Duff3)\
**Post date:** [March 26, 2021, 3:40pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/18 "2021-03-26T15:40:40Z")

</div>

When I use DB Browser for SQLite, I have to display the hidden folders (using CMD+SHIFT+.), then I navigate to:

Library/Application Support/Plex Media Server/Plug-In Support/Databases

I can’t get to the database any other way (Mac OS 10.12.6 Sierra).

---

<div class="post-metadata">

**Author:** ![bpalloni](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bpalloni](https://forums.plex.tv/u/bpalloni)\
**Post date:** [March 26, 2021, 10:09pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/19 "2021-03-26T22:09:15Z")

</div>

I’ve been using sqlite3.exe with PowerShell on Windows to update my Plex DB for a while now and it stopped working after a recent update.  
I found this post and based on @Volts comment I was able to figure out how to get it working again using the Plex EXE.  
Here is a basic command format I use on Windows and with PowerShell in case anyone is interested:

> $PlexDB = “C:\Users\PLEX\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db”  
> $PlexEXE = “C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe”  
> $SQL = “SQLITE STATEMENT HERE”
> 
> & “$PlexEXE” “-sqlite” $PlexDB $SQL

---

<div class="post-metadata">

**Author:** ![taochern](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@taochern](https://forums.plex.tv/u/taochern)\
**Post date:** [March 27, 2021, 3:55am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/20 "2021-03-27T03:55:58Z")

</div>

Thank you!! This works! Just change the \PLEX\ in $PlexDB = “C:\Users\PLEX\AppData\Local\Plex Media Server\Plug-in to your user directory!

---

<div class="post-metadata">

**Author:** ![Yaracuy](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/yaracuy/32/313162_2.png) [@Yaracuy](https://forums.plex.tv/u/Yaracuy)\
**Post date:** [March 27, 2021, 11:09am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/21 "2021-03-27T11:09:57Z")

</div>

Many thanks.

I currently have sqlite.exe in the same dir as the plex DBs and have several batch files with statements like these:

```auto
sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"

sqlite3 com.plexapp.plugins.library.db .dump > dump.sql

```

So the solution would be to change it to this?

```auto
“C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” -sqlite com.plexapp.plugins.library.db "PRAGMA integrity_check"

“C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” -sqlite com.plexapp.plugins.library.db .dump > dump.sql

```

Is the syntax OK?

---

<div class="post-metadata">

**Author:** ![Ferg\_Wh1te\_Yahoo.co.uk](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Ferg\_Wh1te\_Yahoo.co.uk](https://forums.plex.tv/u/Ferg_Wh1te_Yahoo.co.uk)\
**Post date:** [March 27, 2021, 2:51pm UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/22 "2021-03-27T14:51:52Z")

</div>

I eventually discovered by deleting the trigger “fts4\_metadata\_titles\_after\_update\_icu” while having the DB open in DB Browser, I could execute UPDATE “main”.“metadata\_items” SET “added\_at”=“originally\_available\_at” and then do a manual scan. Post scan I just ran the Create DDL for the trigger again:  
CREATE TRIGGER fts4\_metadata\_titles\_after\_update\_icu AFTER UPDATE ON metadata\_items BEGIN INSERT INTO fts4\_metadata\_titles\_icu(docid, title, title\_sort, original\_title) VALUES(new.rowid, new.title, new.title\_sort, new.original\_title); END

---

<div class="post-metadata">

**Author:** ![destroy\_musick](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@destroy\_musick](https://forums.plex.tv/u/destroy_musick)\
**Post date:** [March 29, 2021, 12:50am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/23 "2021-03-29T00:50:28Z")

</div>

I’ve been having issues trying to run this via Windows CMD. If I run the following command, nothing happens and the prompt just returns back to normal (it in fact looks like it just fires up another instance of the PMS process), querying the DB after I can see nothing updated. Are any other windows admins still having trouble?

“C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” --sqlite “C:\Users\david\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db” “update metadata\_items set user\_fields = ‘lockedFields=305’ where id = 488795 and metadata\_type = 8”

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [March 29, 2021, 1:41am UTC](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/24 "2021-03-29T01:41:42Z")

</div>

> [@destroy\_musick](#):
>
> “C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” --sqlite “C:\Users\david\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db” “update metadata\_items set user\_fields = ‘lockedFields=305’ where id = 488795 and metadata\_type = 8”

The forum likes to use “pretty” curly quotes - just to verify, in the command you’re typing, you’re using nice oldschool square quotes?

Does a simple query work?

```
"select * from metadata_items order by id desc limit 3"
"select * from metadata_items where id = 488795"

```

[Next page](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405.md?page=2)
