# Error when attempting SQLite database repair

**URL:** <https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671>\
**Category:** Plex Media Server\
**Tags:** server-windows\
**Created:** [May 24, 2021, 4:47pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671 "2021-05-24T16:47:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mostlyhuman](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mostlyhuman/32/8690_2.png) [@mostlyhuman](https://forums.plex.tv/u/mostlyhuman)\
**Post date:** [May 24, 2021, 4:47pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/1 "2021-05-24T16:47:50Z")

</div>

When doing step 6 of the database repair guide located here:  
[[https://support.plex.tv/articles/201100678-repair-a-corrupt-database/](https://support.plex.tv/articles/201100678-repair-a-corrupt-database/))]

I get this error after running the command:

```auto
At line:1 char:40
+ sqlite3 com.plexapp.plugins.library.db < dump.sql
+ ~
The '<' operator is reserved for future use.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

```

Not finding any helpful solutions online, anyone have any ideas? Thank you for any help!

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [May 24, 2021, 5:17pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/2 "2021-05-24T17:17:30Z")

</div>

That error is generated by PowerShell, not sqlite3 (or Plex). The steps provided the linked procedure need to be run in the “Command Prompt” application. You can open it by clicking the start button in Windows and typing “command prompt.” Or, just run “cmd” from within PowerShell.

Also, depending on your Plex Media Server version, you may need to use its embedded sqlite3 command. Check in C:\Program Files (x86)\Plex\Plex Media Server\ to see if you have “Plex SQLite.exe.” If so, use that to carry out the linked procedure.

---

<div class="post-metadata">

**Author:** ![mostlyhuman](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mostlyhuman/32/8690_2.png) [@mostlyhuman](https://forums.plex.tv/u/mostlyhuman)\
**Post date:** [May 24, 2021, 7:24pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/3 "2021-05-24T19:24:59Z")

</div>

Thank you, now on that same step using the command prompt i am getting:

```auto
Error: near line 2177500: no such collation sequence: icu_root

```

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [May 24, 2021, 7:34pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/4 "2021-05-24T19:34:59Z")

</div>

That’s what I was alluding to in my second paragraph. Recent (relatively) database changes have introduced a dependency on Plex’s built-in SQLite3 application. Not using it will result in the error you quoted.

Check your Plex Media Server installation directory; see if there’s an application named “Plex SQLite.exe.” If so, use that to perform the database repair process. If not, use Plex Media Server.exe with its “–sqlite” option to invoke its embedded SQLite3 module:  
`C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe --sqlite` (in place of any command with references `sqlite3`).

---

<div class="post-metadata">

**Author:** ![mostlyhuman](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mostlyhuman/32/8690_2.png) [@mostlyhuman](https://forums.plex.tv/u/mostlyhuman)\
**Post date:** [May 24, 2021, 7:58pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/5 "2021-05-24T19:58:38Z")

</div>

I sincerely appreciate your help. I dont have the exe version but using Plex Media Server.exe --sqlite , when i do the dump it just creates an empty file that is 0kb.

```auto
Plex Media Server.exe --sqlite com.plexapp.plugins.library.db > dump.sql

```

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [May 24, 2021, 8:30pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/6 "2021-05-24T20:30:43Z")

</div>

Did you include the “.dump” portion of the command?

```auto
Plex Media Server.exe --sqlite com.plexapp.plugins.library.db .dump > dump.sql

```

If so, and it still produced an empty file, I’m not sure what else to suggest. It may be worth it to upgrade to the latest Plex Pass release (1.23.1.4528) so that you can use “Plex SQLite.exe”.

---

<div class="post-metadata">

**Author:** ![mostlyhuman](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mostlyhuman/32/8690_2.png) [@mostlyhuman](https://forums.plex.tv/u/mostlyhuman)\
**Post date:** [May 24, 2021, 10:30pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/7 "2021-05-24T22:30:02Z")

</div>

ahh okay, looks like their steps for repairing a database are outdated. Which command do I use to restore the dump back to a database file? Also do you know if there is a reference somewhere for the basic command switches to use with their built in version of sqlite? Thank you again!

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [May 24, 2021, 11:00pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/8 "2021-05-24T23:00:27Z")

</div>

> [@mostlyhuman](#):
>
> Which command do I use to restore the dump back to a database file?

I believe this should work. Just make sure you have a backup (per the instructions) of your current database first, just in case you need to go through the process again:

```auto
"Plex Media Server.exe" --sqlite com.plexapp.plugins.library.db < dump.sql

```

I performed a test using the linked instructions and they worked fine (using the embedded sqlite module).

> [@mostlyhuman](#):
>
> Also do you know if there is a reference somewhere for the basic command switches to use with their built in version of sqlite?

As far as I know, the available commands should be the same as (or a superset of) those available for the standard sqlite3 executable.

---

<div class="post-metadata">

**Author:** ![mostlyhuman](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mostlyhuman/32/8690_2.png) [@mostlyhuman](https://forums.plex.tv/u/mostlyhuman)\
**Post date:** [May 25, 2021, 2:00pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/9 "2021-05-25T14:00:05Z")

</div>

It still just created a 0kb dump file. I have my metadata/databases in a customer folder

```auto
D:\PlexMetadata\Plex Media Server\Plug-in Support\Databases

```

and my Plex install is in:

```auto
D:\Program Files (x86)\Plex\Plex Media Server

```

I wasnt sure how to get it to recognize where the database file was since it didnt seem to see it when the command was run so I tried temporarily copying the db file to the

```auto
D:\Program Files (x86)\Plex\Plex Media Server

```

directory and that didn’t work, so then i added the install directory to the system path variable which let me run it while in the regular location of the database file but its all still generating a 0kb dump file. Basically when I run

```auto
"Plex Media Server.exe" --sqlite com.plexapp.plugins.library.db .dump > dump.sql

```

It just immediately ends without a proper dump creating the empty 0kb dump file. So frustrating.

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [May 25, 2021, 5:51pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/10 "2021-05-25T17:51:32Z")

</div>

I ran through the procedure myself yesterday to test this. However, my Plex Media Server is installed in the default path, on my C: drive. Also, I tested on version 1.23.1.4528. When I tested, I performed all the steps from within my Plex data directory; in my case that’s:  
`C:\Users\username\AppData\Local\Plex Media Server\Plug-in Support\Databases\`

I also ran the commands using the full, quoted path to the Plex Media Server executable. For example, to create the dump:  
`"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" --sqlite com.plexapp.plugins.library.db .dump > dump.sql`

You may want to try upgrading to the latest Plex Pass beta release, if you haven’t already.

If all else fails, you may be able to [restore a backed up database](https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [August 23, 2021, 5:51pm UTC](https://forums.plex.tv/t/error-when-attempting-sqlite-database-repair/717671/11 "2021-08-23T17:51:41Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
