# DATABASECHANGELOG does not exist or not authorized

**URL:** https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876
**Category:** Liquibase Development
**Created:** [December 4, 2020, 11:53pm UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876 "2020-12-04T23:53:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![shailendra](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@shailendra](https://forum.liquibase.org/u/shailendra)
#### Post date: [December 4, 2020, 11:53pm UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876/1 "2020-12-04T23:53:52Z")

</div>

Hi Everyone,  
here is the scenario where liquibase is failing to manage its DATABASECHANGELOG table in multiple  
database environments with same schema name…

we have 3 databases in snowflake

1. DEV
2. CERT
3. PROD  
each having the same schema name i.e TEAM\_TEAMNAME\_XYZ\_SCHEMA (for eg).

we are using a service account to run update command against each of these databases.  
the service account has role assigned to them as per the database.

what we found out was that liquibase on issuance of the ‘update’ command does the following thing behind the scene:  
show /\* JDBC:DatabaseMetaData.getTables() \*/ tables like ‘DATABASECHANGELOG’ in account

which in short is weird for the reason that , in case it finds the ‘DATABASECHANGELOG’ in one of the  
databases where it is already present and not currently present in the target database, it starts writing in the target database to the table (i.e DATABASECHANGELOG) ,without creating it and finally throws the error.

"SQL compilation error: Object ‘CERT.TEAM\_TEAMNAME\_XYZ\_SCHEMA.DATABASECHANGELOG’ does not exist or not authorized.  
SELECT MD5SUM FROM TEAM\_TEAMNAME\_XYZ\_SCHEMA.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL "

NOTE: in this case,the changes have been successfully applied to the DEV databases, since DEV being the first environment liquibase runs against with no exising changelog and changelock tables, liquibase ends up applying changes after creating them.  
but as soon liquibase is pointed toward the CERT environment for the purpose of build promotion, it fails., as behind the scenes it finds out the table DATABASECHANGELOG is already present in DEV database, and without even creating it ,it starts complaining about authorization. However it successfully creates the ‘DATABASECHANGELOGLOCK’ in the target database.

STEPS to replicate: for snowflake database:

1. create 3 diff databases in snowflake
2. create same schema names in all of them
3. use the same service account to write liquibase chagnes to them.

---

<div class="post-metadata">

### Author: ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)
#### Post date: [December 22, 2020, 12:04am UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876/2 "2020-12-22T00:04:03Z")

</div>

Hi @shailendra,

What version of liquibase were you using? This sounds like a bug, the liquibase snowflake extension has a bug tracker [here](https://github.com/liquibase/liquibase-snowflake/issues), I would report it there.

Thanks,

Ronak

---

<div class="post-metadata">

### Author: ![shailendra](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@shailendra](https://forum.liquibase.org/u/shailendra)
#### Post date: [December 22, 2020, 12:25am UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876/3 "2020-12-22T00:25:32Z")

</div>

thanks @ronak for sharing the bug report link. currently i am on liquibase 4.0.0

---

<div class="post-metadata">

### Author: ![rajat](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@rajat](https://forum.liquibase.org/u/rajat)
#### Post date: [August 26, 2021, 8:25am UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876/4 "2021-08-26T08:25:05Z")

</div>

Even i am facing the same problem. @ronak @shailendra , did you get any lead here?

---

<div class="post-metadata">

### Author: ![shailendra](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@shailendra](https://forum.liquibase.org/u/shailendra)
#### Post date: [October 7, 2021, 11:42am UTC](https://forum.liquibase.org/t/databasechangelog-does-not-exist-or-not-authorized/4876/5 "2021-10-07T11:42:47Z")

</div>

hi @rajat, we got over this problem by specifying the different changelogtable name per environment, i.e for dev ,provide a prefix \_DEV to your datatabsechangelogtablename in your properties file, repeat it for cert(or any other environment) with a specific prefix.
