1
votes

I have a simple change log file for testing purposes that applies 1 changeSet which drops a table and creates it. We have 20 DEV / QA databases all on the same version of DB2, OS, etc. This changeSet works in 19 of them. It bombs in 1 DB with the error which is listed below. The databasechangelog and databasechangeloglock tables are never built.

I am unable to find much help online. Any help you can provide is most appreciated!

Error

Unexpected error running Liquibase: liquibase.snapshot.InvalidExampleException: Found multiple catalogs matching XXX

SEVERE 12/9/14 2:02 PM: liquibase: liquibase.snapshot.InvalidExampleException: Found multiple catalogs matching XXX liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.snapshot.InvalidExampleException: gs matching XXX at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:214) at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:153) at liquibase.Liquibase.update(Liquibase.java:182) at liquibase.Liquibase.update(Liquibase.java:174) . . .

databaseChangeLog.xml 
=====================
<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
   xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> 

   <preConditions>
      <dbms type="DB2"/>
   </preConditions>

   <include file="db2\viewname_changeSet_005.xml"/>

</databaseChangeLog>


viewname_changeSet_005.xml 
==========================
<databaseChangeLog
   xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> 

   <changeSet id="STPL_TEST Drop Table" author="Joan">
      <preConditions onFail="CONTINUE">
         <sqlCheck expectedResult="1">SELECT COUNT(*) FROM syscat.tables where tabname = 'STPL_TEST'</sqlCheck>
       </preConditions>
      <sql>
         DROP TABLE STPL_TEST; 
      </sql>
   </changeSet>

   <changeSet id="STPL_TEST Create Table" author="Joan">
      <sql>
         CREATE TABLE STPL_TEST (
           ST_ID     BIGINT NOT NULL,
           ST_VCHAR  VARCHAR(10),
           ST_DATE   DATE
         );
      </sql>
   </changeSet>

</databaseChangeLog>
1
Do you have the two catalogs with the same name but different cases?Nathan Voxland
By catalogs do you mean schemas? I do not find any duplicate rows when running this select: select * from syscat.schemata order by 1;Joan B.
And when I run this command on the db server, it does not return duplicate entries: db2 list db directoryJoan B.
Found it! select distinct table_catalog, table_schema from sysibm.tables; Will get it corrected. Thank You Nathan!Joan B.
The select above now only returns 1 table_schema but the Liquibase issue persists. Can you please let me know what Liquibase is running to determine that more than 1 catalog exists? This DB is in use, and I can create tables with no issues. Liquibase is bombing when attempting to create the databasechangelog table. Thanks!Joan B.

1 Answers

0
votes

It might have happened, because Oracle created 2 identically named users, that differ only with registry. So in your example if your user is XXX, during creation of this user Oracle could create also user named xxx or "XXX" and so on. You can check it by running

SELECT * FROM all_users 
order by username

Then you have to drop your user, using quotes. If it is administrative one, run

alter session set “_oracle_script”=true;
drop user "xxx" cascade;

If not, just drop user using quotes