Home > database >  Liquibase ORA-01031: insufficient privileges
Liquibase ORA-01031: insufficient privileges

Time:11-21

I get this error message for just including liquibase as a dependency & having it enabled (default).

<dependency>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-core</artifactId>
  <version>4.5.0</version>
</dependency>

Caused by: liquibase.exception.DatabaseException: ORA-01031: insufficient privileges [Failed SQL: (1031) CREATE TABLE MYSCHEMA.DATABASECHANGELOGLOCK (ID INTEGER NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR2(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))]

I have an existing functioning DataSource & HikariConfig to an Oracle DB thru Kerberos Authentication. I am confused on how its trying to execute sql code... I haven't declared any @LiquibaseDataSource or even a changelog for that matter.

CodePudding user response:

If you are using Spring Boot, just by adding liquibase dependency SB will auto-configure it with your existing DataSource. And on the first start of the application on an empty database Liquibase bean will try to execute the creation of it's two utility tables:

DATABASECHANGELOGLOCK and DATABASECHANGELOG

So, user from your primary DataSource is being picked up by Liquibase, and probably doesn't have sufficient privileges to create tables on this schema. This is why you are seeing this message.

  • Related