Liquibase - Error on SYSTEM.DATABASECHANGELOGLOCK while re-executing a migration -


i'm using liquibase 3.0.2, ant task updatedatabase , change sets defined directly inside sql scripts using comments like

--liquibase formatted sql --changeset com.noemalife:1 dbms:oracle 

etc.

the first run works fine, change sets executed , db objects (oracle) deployed. can see databasechangelog , databasechangeloglock tables filled up.

then try re-run ant task same exact configuration, expecting liquibase "ok, deployed, nothig here."

but instead:

c:\users\dmusiani\desktop\liquibase-test>ant migrate buildfile: build.xml  migrate:      [copy] copying 1 file c:\users\dmusiani\desktop\liquibase-test  build failed liquibase.exception.lockexception: liquibase.exception.databaseexception: error executing sql create  table system.databasechangeloglock (id integer not null, locked number(1) not null, lockgranted tim estamp, lockedby varchar2(255), constraint pk_databasechangeloglock primary key (id)); on jdbc:oracl e:thin:@localhost:1521:wbmdinsert system.databasechangeloglock (id, locked) values (1, 0): ora- 00955: nome giÓ utilizzato da un oggetto esistente          @ liquibase.lockservice.lockserviceimpl.acquirelock(lockserviceimpl.java:122)         @ liquibase.lockservice.lockserviceimpl.waitforlock(lockserviceimpl.java:62)         @ liquibase.liquibase.update(liquibase.java:123)         @ liquibase.integration.ant.databaseupdatetask.executewithliquibaseclassloader(databaseupda tetask.java:45)         @ liquibase.integration.ant.baseliquibasetask.execute(baseliquibasetask.java:70)         @ org.apache.tools.ant.unknownelement.execute(unknownelement.java:288)         @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)         @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)         @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)         @ java.lang.reflect.method.invoke(method.java:597)         @ org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106)         @ org.apache.tools.ant.task.perform(task.java:348)         @ org.apache.tools.ant.target.execute(target.java:357)         @ org.apache.tools.ant.target.performtasks(target.java:385)         @ org.apache.tools.ant.project.executesortedtargets(project.java:1337)         @ org.apache.tools.ant.project.executetarget(project.java:1306)         @ org.apache.tools.ant.helper.defaultexecutor.executetargets(defaultexecutor.java:41)         @ org.apache.tools.ant.project.executetargets(project.java:1189)         @ org.apache.tools.ant.main.runbuild(main.java:758)         @ org.apache.tools.ant.main.startant(main.java:217)         @ org.apache.tools.ant.launch.launcher.run(launcher.java:257)         @ org.apache.tools.ant.launch.launcher.main(launcher.java:104) caused by: liquibase.exception.databaseexception: error executing sql create table system.databasech angeloglock (id integer not null, locked number(1) not null, lockgranted timestamp, lockedby varchar 2(255), constraint pk_databasechangeloglock primary key (id)); on jdbc:oracle:thin:@localhost:1521:w bmdinsert system.databasechangeloglock (id, locked) values (1, 0): ora-00955: nome giÓ utilizza da un oggetto esistente          @ liquibase.executor.jvm.jdbcexecutor.execute(jdbcexecutor.java:56)         @ liquibase.executor.jvm.jdbcexecutor.execute(jdbcexecutor.java:98)         @ liquibase.executor.jvm.jdbcexecutor.execute(jdbcexecutor.java:64)         @ liquibase.database.abstractjdbcdatabase.checkdatabasechangeloglocktable(abstractjdbcdatab ase.java:771)         @ liquibase.lockservice.lockserviceimpl.acquirelock(lockserviceimpl.java:95)         ... 21 more caused by: java.sql.sqlexception: ora-00955: nome giÓ utilizzato da un oggetto esistente          @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:113)         @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:331)         @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:288)         @ oracle.jdbc.driver.t4c8oall.receive(t4c8oall.java:754)         @ oracle.jdbc.driver.t4cstatement.dooall8(t4cstatement.java:210)         @ oracle.jdbc.driver.t4cstatement.executeforrows(t4cstatement.java:963)         @ oracle.jdbc.driver.oraclestatement.doexecutewithtimeout(oraclestatement.java:1192)         @ oracle.jdbc.driver.oraclestatement.executeinternal(oraclestatement.java:1731)         @ oracle.jdbc.driver.oraclestatement.execute(oraclestatement.java:1701)         @ liquibase.executor.jvm.jdbcexecutor$1executestatementcallback.doinstatement(jdbcexecutor. java:86)         @ liquibase.executor.jvm.jdbcexecutor.execute(jdbcexecutor.java:49)         ... 25 more  total time: 1 second c:\users\dmusiani\desktop\liquibase-test> 

it seems me liquibase trying re-create databasechangeloglock table.

i have problem when run liquibase oracle "system" user (my patch cares creating couple of other users, testing purposes use system directly that). other strange thing after system's patch run succesfully, in lock table can still see lock active. when run other patches in other schemas(ex. ones created system's patch), have patch completing , lock released in lock table; relaunching patch behaves expected: liquibase detects patch in place ad nothing.

this said, doubt if liquibase has problems, in system schema, in detecting lock table existing (and fails trying deploy it) or if there kind of locking/commit problem.

any suggestion welcome

thanks

davide

i'm facing same issue you. see sources, when running system, following condition (databasesnapshot#include) evaluated true.

    if (database.issystemobject(example)) {         return null;     } 

because of that, creation attempted. i'm gonna work further on patch , keep updated.

and here patch proposal.


Comments