我有两种模式:OWNER&我的Oracle数据库中的USER。基本上,所有表都是在OWNER中创建的,之后使用USER帐户创建同义词。
<execution>
<id>apply.owner</id>
<phase>process-resources</phase>
<configuration>
<url>${database.url}</url>
<username>${database.owner.user}</username>
<password>${database.owner.password}</password>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<changeLogFile>${changelog.owner.file}</changeLogFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>apply.user</id>
<phase>process-resources</phase>
<configuration>
<url>${database.url}</url>
<username>${database.user.user}</username>
<password>${database.user.password}</password
<driver>oracle.jdbc.driver.OracleDriver</driver>
<changeLogFile>${changelog.user.file</changeLogFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
为OWNER帐户创建了DATABASECHANGELOG(LOCK)表,添加了USER帐户的同义词,我可以在SQL开发人员中看到它们。但是当我为USER模式运行初始迁移时,我得到了:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.8:rollback (apply.user) on project liquitest: Error setting up or running Liquibase: liq
uibase.exception.DatabaseException: Error executing SQL CREATE TABLE DATABASECHANGELOGLOCK (ID NUMBER(10) NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMES
TAMP, LOCKEDBY VARCHAR2(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID)): ORA-01031: insufficient privileges -> [Help 1]
为什么当我可以使用USER帐户从DATABASECHANGELOGLOCK表中选择时,它会尝试创建此表? 谢谢!
答案 0 :(得分:2)
Liquibase检查数据库元数据是否存在databasechangelog表,但遗憾的是它没有查看同义词的功能。
如果您需要将USER.DATABASECHANGELOG作为同义词,则需要创建liquibase.snapshot.jvm.TableSnapshotGenerator的子类,该子类可以处理DATABASECHANGELOG表的响应的同义词或硬编码。