在Ubuntu中运行liquibase脚本后会出现错误,但在windows中工作正常



我尝试在Ubuntu终端上运行liquibase脚本,我得到错误:

Unexpected error running Liquibase: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]

在Ubuntu终端上运行脚本,我使用以下代码:

export LIQUIBASE_HOME=/home/bok/Liquibase
java -jar liquibase.jar 
      --driver=com.mysql.jdbc.Driver 
      --classpath=mysql-connector-java-5.1.36.jar 
      --changeLogFile="dbchangelog.xml" 
      --url="jdbc:mysql://localhost:3306/database" 
      --username=root 
      --password=password 
      update

在Windows操作系统上,这是脚本工作正常。为了在Windows中运行,我从以下代码创建*.bat文件:

set LIQUIBASE_HOME=D:workliquibase
java -jar liquibase.jar 
    --logLevel=DEBUG 
    --driver=com.mysql.jdbc.Driver  
    --classpath=mysql-connector-java-5.1.36.jar 
    --changeLogFile="D:dbchangelog.xml"
    --url="jdbc:mysql://localhost:3306/database"  
    --username=root 
    --password=root 
    update
pause

我使用MySQL 5.6, Ubuntu 14.04和Windows 8.1,文件dbchangelog.xml是相同的。如何在Ubuntu上运行成功的脚本?

编辑

所有加

:

    UTE database command: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)
SEVERE 16.10.15 18:08: liquibase: /home/bok/Liquibase/dbchangelog.xml: /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu: Change Set /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu failed.  Error: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
liquibase.exception.DatabaseException: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
    at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
    at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
    at liquibase.Liquibase.update(Liquibase.java:210)
    at liquibase.Liquibase.update(Liquibase.java:190)
    at liquibase.integration.commandline.Main.doMigration(Main.java:1096)
    at liquibase.integration.commandline.Main.run(Main.java:180)
    at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'database.batch_job_execution' doesn't exist
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
    at com.mysql.jdbc.Util.getInstance(Util.java:383)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2541)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2499)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:844)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:748)
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
    ... 12 more
DEBUG 16.10.15 18:08: liquibase: /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu: Release Database Lock
DEBUG 16.10.15 18:08: liquibase: /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu: Executing UPDATE database command: UPDATE database.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
INFO 16.10.15 18:08: liquibase: /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu: Successfully released change log lock
Unexpected error running Liquibase: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
SEVERE 16.10.15 18:08: liquibase: /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
liquibase.exception.MigrationFailedException: Migration failed for change set /home/bok/Liquibase/dbchangelog.xml::1358761283019-16::royu:
     Reason: liquibase.exception.DatabaseException: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:584)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
    at liquibase.Liquibase.update(Liquibase.java:210)
    at liquibase.Liquibase.update(Liquibase.java:190)
    at liquibase.integration.commandline.Main.doMigration(Main.java:1096)
    at liquibase.integration.commandline.Main.run(Main.java:180)
    at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.exception.DatabaseException: Table 'database.batch_job_execution' doesn't exist [Failed SQL: CREATE INDEX JOB_START_STATUS ON database.batch_job_execution(STATUS, START_TIME)]
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
    at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1247)
    at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1230)
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:548)
    ... 7 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'database.batch_job_execution' doesn't exist
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
    at com.mysql.jdbc.Util.getInstance(Util.java:383)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2541)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2499)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:844)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:748)
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
    ... 12 more

从给出的信息来看,问题似乎不是平台特定的,而是更改日志试图在不存在的表上创建索引。

相关内容

  • 没有找到相关文章

最新更新