# DATABASECHANGELOGLOCK and DATABASECHANGELOG tables

**URL:** <https://forum.liquibase.org/t/databasechangeloglock-and-databasechangelog-tables/6500>\
**Category:** Liquibase Development\
**Created:** [February 7, 2022, 6:20pm UTC](https://forum.liquibase.org/t/databasechangeloglock-and-databasechangelog-tables/6500 "2022-02-07T18:20:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@Dinesh1](https://forum.liquibase.org/u/Dinesh1)\
**Post date:** [February 7, 2022, 6:20pm UTC](https://forum.liquibase.org/t/databasechangeloglock-and-databasechangelog-tables/6500/1 "2022-02-07T18:20:58Z")

</div>

In our application there are four database (MS SQL SERVER) namely

1. db1  
2.db2  
3.db3  
4.db4

While connecting to SQL using liquibase we use db2 in connection string and then perform deployment.  
As db2 is used in connection string DATABASECHANGELOGLOCK and DATABASECHANGELOG are created in db2 database.  
As a part of deployment, every sql script has database name at the start like

1. Script1.sql  
Use db1  
GO  
—update/delete statements  
GO

2. Script2.sql  
Use db2  
GO  
—update/delete statements  
GO

3. Script3.sql  
Use db3  
GO  
—update/delete statements  
GO

4. Script4.sql  
Use db4  
GO  
—update/delete statements  
GO

If the last script in the deployment is db2 (as it is specifed in the connection string and the DATABASECHANGELOGLOCK and DATABASECHANGELOG) are created in db2 database.  
then the deployment succeeds

But if the last script is of some other database (other than db2) it gves error  
liquibase.exception.LockException: liquibase.exception.LockException: Did not update change log lock correctly.

Seems it goes to search the DATABASECHANGELOGLOCK and DATABASECHANGELOG in the database in which last script is deployed.

How I can handle this ?

---

<div class="post-metadata">

**Author:** ![tabbyfoo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/tabbyfoo/32/748_2.png) [@tabbyfoo](https://forum.liquibase.org/u/tabbyfoo)\
**Post date:** [March 30, 2022, 3:52pm UTC](https://forum.liquibase.org/t/databasechangeloglock-and-databasechangelog-tables/6500/2 "2022-03-30T15:52:34Z")

</div>

Hey, @Dinesh1 - thanks for posting this issue. I am researching to try to find an answer for you. When we have something to share, I or one of my teammates will reply again to follow up.

Regards,  
Tabby

---

<div class="post-metadata">

**Author:** ![szandany](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@szandany](https://forum.liquibase.org/u/szandany)\
**Post date:** [April 1, 2022, 1:57pm UTC](https://forum.liquibase.org/t/databasechangeloglock-and-databasechangelog-tables/6500/3 "2022-04-01T13:57:44Z")

</div>

There is a [multi-catalog project setup example](https://github.com/liquibase/liquibase-toolbox/tree/master/project_examples/multi_catalog_example) in the [Liquibase Toolbox](https://github.com/liquibase/liquibase-toolbox) repository. I highly recommend that you check it out! Also, feel free to contribute!
