# Database is Locked pmm 2.38.1

**URL:** <https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310>\
**Category:** PMM 2.x\
**Created:** [August 8, 2023, 1:14pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310 "2023-08-08T13:14:20Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 17, 2023, 1:36pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/21 "2023-08-17T13:36:40Z")

</div>

@steve.hoffman @meyerder

But for me, issues still exist. Again, I am trying to add the servers to PMM, and again, I am facing the same issue. 🥲

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 17, 2023, 1:44pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/22 "2023-08-17T13:44:32Z")

</div>

@steve.hoffman After crossing the 100 nodes again, I faced the same issue.

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [August 17, 2023, 4:15pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/23 "2023-08-17T16:15:56Z")

</div>

Hi @Naresh9999 can I ask 2 questions?  
Have you migrated to service accounts? Is it possible that one of your old PMM Clients are still configured to old server or have incorrect API key and keeps trying to connect to PMM Server?

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 17, 2023, 6:18pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/24 "2023-08-17T18:18:09Z")

</div>

@nurlan I have never migrated to service accounts. This is a new server I have created from scratch.  
Is there any way that I can identify which server is trying?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/0/03d8a26c643a1664f2f68498ccf594b615d6c993.png)

---

<div class="post-metadata">

**Author:** ![meyerder](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/meyerder/32/16994_2.png) [@meyerder](https://forums.percona.com/u/meyerder)\
**Post date:** [August 18, 2023, 4:27pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/25 "2023-08-18T16:27:27Z")

</div>

for What it is worth… I did a search for grafana.db inside the docker and found two of them… Not quite sure why or if somehow I did it…

But Once I did pragma journal\_mode=wal on both files I have not seen it (yet) I did NOT think to look at the other potential settings prior to me setting this

Additionally I did find that when I work with the Alerting aspect quickly I tend to see it happen more often (modifying alerts after using a Template base that comes with pmm)

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 25, 2023, 4:30pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/26 "2023-08-25T16:30:05Z")

</div>

@meyerder

Can you please share the locations?  
or  
How can I search, Can you please guide me?

---

<div class="post-metadata">

**Author:** ![meyerder](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/meyerder/32/16994_2.png) [@meyerder](https://forums.percona.com/u/meyerder)\
**Post date:** [August 25, 2023, 4:33pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/27 "2023-08-25T16:33:40Z")

</div>

Inside the docker

find / -name grafana.db  
cd to the directory. also research a few other tweaks you can do on the file I am running 80 nodes now with no issues

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 25, 2023, 5:07pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/28 "2023-08-25T17:07:25Z")

</div>

@meyerder

I found the below files.

bash-5.1# find / -name grafana.db  
/etc/grafana/grafana.db  
/opt/grafana.db  
/srv/grafana/grafana.db  
/usr/share/grafana/grafana.db  
bash-5.1#

---

<div class="post-metadata">

**Author:** ![meyerder](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/meyerder/32/16994_2.png) [@meyerder](https://forums.percona.com/u/meyerder)\
**Post date:** [August 26, 2023, 6:44pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/29 "2023-08-26T18:44:54Z")

</div>

@Naresh9999 @Lauri

While I do NOT know if it is suggested I have not seen the issue since I did the following as well as the above (Again on each grafana.db file as I had two but was not sure WHY I had two)  
Do this at your own risk…\*\*\*\* I only did the first three .

**When you issue the commands you MUST be in the directory that the grafana.db file is in… Else it does nothing**

```auto
sqlite> pragma journal_mode=wal;
sqlite> PRAGMA cache_size = 10000; -- Set cache size to 10000 pages
sqlite> PRAGMA synchronous = OFF; -- Disable synchronous write (less durable, more performance)
sqlite> PRAGMA locking_mode = EXCLUSIVE; -- Use exclusive locking mode

sqlite> PRAGMA busy_timeout = 1000; -- Set a timeout of 1 second for waiting on locks
sqlite> PRAGMA temp_store = MEMORY; -- Use memory for temporary storage (if feasible)

```

Also if you are like me and new to Docker Make sure you commit the changes as well (and then I normally restart the docker)

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 28, 2023, 5:38am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/30 "2023-08-28T05:38:42Z")

</div>

@meyerder

Many thanks for your assistance. I’ll test out the aforementioned suggestions and keep you informed of my results.

---

<div class="post-metadata">

**Author:** ![meyerder](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/meyerder/32/16994_2.png) [@meyerder](https://forums.percona.com/u/meyerder)\
**Post date:** [August 29, 2023, 12:52pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/31 "2023-08-29T12:52:16Z")

</div>

@Naresh9999 and the result was?

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 29, 2023, 2:35pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/32 "2023-08-29T14:35:47Z")

</div>

@meyerder New servers are being added to PMM, and so far, so good. I will update you complete status by tomorrow or day after tomorrow.

Only the parameters below have been altered by me:

sqlite\> pragma journal\_mode=wal;

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 30, 2023, 2:54pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/33 "2023-08-30T14:54:22Z")

</div>

@meyerder @steve.hoffman @nurlan @Roma_Novikov

The issue was fixed by switching the journal\_mode from del to wal. As of now, PMM is functioning well.  
Thanks for all your support.

SQLlite DB path: **/srv/grafana/grafana.db**

---

<div class="post-metadata">

**Author:** ![Roma\_Novikov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roma_novikov/32/1161_2.png) [@Roma\_Novikov](https://forums.percona.com/u/Roma_Novikov)\
**Post date:** [August 31, 2023, 10:24am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/34 "2023-08-31T10:24:34Z")

</div>

Thanks for the update, @Naresh9999!  
Everyone suffering from the issue - can use this workaround.  
We are in the final stages of testing PG inside PMM, so this problem should disappear.

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 31, 2023, 11:31am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/35 "2023-08-31T11:31:29Z")

</div>

@Roma_Novikov

It seems that two SQLite databases are running inside a container, so we are migrating both SQLite databases to PostgreSQL, right, Roma?

---

<div class="post-metadata">

**Author:** ![Roma\_Novikov](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roma_novikov/32/1161_2.png) [@Roma\_Novikov](https://forums.percona.com/u/Roma_Novikov)\
**Post date:** [August 31, 2023, 11:37am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/36 "2023-08-31T11:37:31Z")

</div>

we’ll migrate SQLite used by Grafana. not sure is this one or several Db 🤔

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [August 31, 2023, 11:46am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/37 "2023-08-31T11:46:12Z")

</div>

@Roma_Novikov Can you please check whether the below path or not?

SQLlite DB path: **/srv/grafana/grafana.db**

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [September 1, 2023, 11:28am UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/38 "2023-09-01T11:28:30Z")

</div>

@Roma_Novikov Is it the same DB that Grafana uses?

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [September 1, 2023, 12:28pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/39 "2023-09-01T12:28:08Z")

</div>

@Naresh9999 yes, that’s a correct path used by grafana.

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [September 1, 2023, 1:15pm UTC](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310/40 "2023-09-01T13:15:25Z")

</div>

Thanks @nurlan for the confirmation.

Therefore, none of the services will use the other SQLite databases mentioned below. In that case, do we have to move the items below, or is it not necessary?

1. /etc/grafana/grafana.db
2. /opt/grafana.db
3. /usr/share/grafana/grafana.db

[Previous page](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310.md?page=1)

[Next page](https://forums.percona.com/t/database-is-locked-pmm-2-38-1/24310.md?page=3)
