# Database commitment

**URL:** <https://forums.plex.tv/t/database-commitment/679409>\
**Category:** Plex Media Server\
**Tags:** server-qnap\
**Created:** [January 17, 2021, 5:28pm UTC](https://forums.plex.tv/t/database-commitment/679409 "2021-01-17T17:28:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 17, 2021, 5:28pm UTC](https://forums.plex.tv/t/database-commitment/679409/1 "2021-01-17T17:28:31Z")

</div>

Hi,

I have PLEX server installed on my QNAP NAS  
Supposing I make a change on PLEX server on my QNAP NAS (new playlist PL1 for example)  
On Plex server itself all is fine

A Few seconds after via WINSCP, I copy the SQLITE file main database  
I perform a select SQL on metadata\_items type 15

**Can’t see my new playlist PL1 !!!**

If I do the same operation on PLEX server but this time I wait a while (15 minutes) before using WINSCP then this time the database transferred shows me my PL1 playlist

If I do the same operation on PLEX server but this time I perform immediately a DATABASE optimization then use WINSCP then this time the database transferred shows me my PL1 playlist

Looks like main SQLITE database on PLEX server is not updated immediately, either I have to wait a long while or I have to do DATABASE optimization.

Is there a way to commit changes immediately without the need to wait and/or to perform optimization operation.

Hope I am not too confusing. Thanks

Player Version#:

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [January 17, 2021, 5:48pm UTC](https://forums.plex.tv/t/database-commitment/679409/2 "2021-01-17T17:48:50Z")

</div>

There is no mechanism to force the main file to update.  
What you’re seeing is because you’re bypassing the WAL and SHM.

Restructure your opening of the DB to use the WAL & SHM.

Please do understand, this level of access is out of scope.  
We cannot support this level of access to the DB.

---

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 17, 2021, 6:23pm UTC](https://forums.plex.tv/t/database-commitment/679409/3 "2021-01-17T18:23:33Z")

</div>

Oops,  
I just found that I was missing to copy **db-shm** and **db-wal**. Now I got the change immediately on SQLITE studio.

Sorry for disturbing

---

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 17, 2021, 6:56pm UTC](https://forums.plex.tv/t/database-commitment/679409/5 "2021-01-17T18:56:13Z")

</div>

Hola, Many many thanks ChuckPa

I just found about WAL and SHM before reading your reply. Nevertheless, you are very kind. Yes you are absolutely right, this is out of scope. In fact what I do is :

From my client windows I run a tool that copy the database just to perform only a select to check if songs are there then I build URL’s to create playlist with items.

In fact, I do this because I did not find any way to perform a remote select (RDBMS) onto the Plex server database being on my QNAP.

If you have an idea it will help. However, once again thanks for having to take care of my post.

---

<div class="post-metadata">

**Author:** ![TeknoJunky](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/teknojunky/32/165055_2.png) [@TeknoJunky](https://forums.plex.tv/u/TeknoJunky)\
**Post date:** [January 17, 2021, 7:04pm UTC](https://forums.plex.tv/t/database-commitment/679409/6 "2021-01-17T19:04:58Z")

</div>

you should never copy the database files while plex is running, your copies can easily be corrupted during the middle of the copy if the original changes

from your qnap command line, you should be able to access sqlite and send queries (not updates) to the database even while plex is running

`sqlite3 /path/to/database.db "select blah blah blah"`

obviously, this is not supported by plex, so ensure you have adequate backups.

plex does automatic db backups every 3 days, if enabled

![image](https://global.discourse-cdn.com/plex/original/3X/6/1/6182896bf0d544bf8c9916668e5b62d6d1de246a.jpeg)

also, if you are into programming, you may want to research how to access plex via API, check out ‘tautulli’ or ‘export tools’ for some ideas

---

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 17, 2021, 8:08pm UTC](https://forums.plex.tv/t/database-commitment/679409/7 "2021-01-17T20:08:19Z")

</div>

Hi, Many thanks

You’re right, this is why I perform a Plex shutdown before, copy the bases then restart Plex.

Well not sure that I follow you regarding "sqlite3 /path/to/database.db “select blah blah blah”

I am running a powershell on my windows client. Qnap path /share/CACHEDEV1\_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server/Plug-in Support/Databases where is located the DB is not share and cannot be accessed unless I miss something around. Have you a solution ?

Thanks

---

<div class="post-metadata">

**Author:** ![TeknoJunky](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/teknojunky/32/165055_2.png) [@TeknoJunky](https://forums.plex.tv/u/TeknoJunky)\
**Post date:** [January 17, 2021, 8:14pm UTC](https://forums.plex.tv/t/database-commitment/679409/8 "2021-01-17T20:14:53Z")

</div>

> [@philippe.malterre\_live.fr](#):
>
> Well not sure that I follow you regarding

I mean if you remote into your QNAP (ie via SSH) so you can get a linux command line prompt, you could then query the database, without having to stop/backup/restart.

if you are not familiar with linux or how to SSH, then I would suggest researching through google, if that is something you want to pursue.

there is no remote access to the database, other than indirectly through plex API.

so either continue to stop/backup/copy/restart and work on the files while on windows, or learn how to carefully access linux and use sqlite3 directly via linux command line, or learn how to use plex API to get information from plex over http/https.

edit, one other way to more easily get the database, _without having to stop plex_

open [Plex Web](https://app.plex.tv/desktop) \> settings \> troubleshooting (scroll down bottom left side) \> download database

---

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 17, 2021, 10:04pm UTC](https://forums.plex.tv/t/database-commitment/679409/9 "2021-01-17T22:04:26Z")

</div>

Hi Tekno,

Yes you’re right. A shell command via ssh will do. Just to work around the return result. I will give it a go and let you know. Once again many thanks for sharing ideas and help. I really appreciate.

---

<div class="post-metadata">

**Author:** ![philippe.malterre\_live.fr](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/philippe.malterre_live.fr/32/87041_2.png) [@philippe.malterre\_live.fr](https://forums.plex.tv/u/philippe.malterre_live.fr)\
**Post date:** [January 23, 2021, 7:23am UTC](https://forums.plex.tv/t/database-commitment/679409/10 "2021-01-23T07:23:00Z")

</div>

Hi all,  
Special thanks to ChuckPa & TeknoJunky.  
I follow your recommendations and I made a new process to access Plex DB in remote (SSH commands).  
I succeed collecting information via DML select statements however I was not able to delete/insert playlists regarding a “natural sort” index problem. I did few checks and I can confirm that my PLEX DB is not corrupted. Nevertheless, I use URI post method instead. It is even better regarding internal integrity.

In summary :  
Select to collect information  
URI to delete and create playlists

Many many thanks

---

<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:** [April 23, 2021, 7:23am UTC](https://forums.plex.tv/t/database-commitment/679409/11 "2021-04-23T07:23:15Z")

</div>

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