Quantcast
Channel: Liquibase Forums
Viewing all 1169 articles
Browse latest View live

Liquibase diffChangeLog SQL Server

$
0
0
Hi,
When i just run Liquibase 3.5.3 with command

liquibase.bat --defaultsFile=DB_DIFF.properties diffChangeLog

The File DB_DIFF.properties content:

driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
classpath: C:\\Program Files\\Microsoft JDBC Driver 6.0 for SQL Server\\sqljdbc_6.0\\enu\\jre8\\sqljdbc42.jar
url: jdbc:sqlserver://DBSERVER1:1433;databaseName=DATABASE01;integratedSecurity=false;
username: sa
password: xxxxxx
referenceUrl: jdbc:sqlserver://DBSERVER02:1433;databaseName=DATABASE02;integratedSecurity=false;
referenceUsername: sa
referencePassword: xxxxxx
changeLogFile: C:\\Liquibase\\DiffChangeLogFile.xml

I get the Exception:

Unexpected error running Liquibase: java.lang.ClassCastException: liquibase.statement.DatabaseFunction cannot be cast to java.lang.Integer

With LogLevel Activated:

liquibase: java.lang.ClassCastException: liquibase.statement.DatabaseFunction cannot be cast to java.lang.Integer
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.ClassCastException: liquibase.statement.DatabaseFunction cannot be cast to java.lang.Integer
        at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:233)
        at liquibase.integration.commandline.Main.doMigration(Main.java:996)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.command.CommandExecutionException: java.lang.ClassCastException: liquibase.statement.DatabaseFunction cannot be cast to java.lang.Integer
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
        at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:231)
        ... 3 more
Caused by: java.lang.ClassCastException: liquibase.statement.DatabaseFunction cannot be cast to java.lang.Integer
        at java.lang.Integer.compareTo(Unknown Source)
        at liquibase.diff.ObjectDifferences$StandardCompareFunction.areEqual(ObjectDifferences.java:133)
        at liquibase.diff.ObjectDifferences.compare(ObjectDifferences.java:69)
        at liquibase.diff.ObjectDifferences.compare(ObjectDifferences.java:50)
        at liquibase.diff.compare.core.DefaultDatabaseObjectComparator.findDifferences(DefaultDatabaseObjectComparator.java:85)
        at liquibase.diff.compare.DatabaseObjectComparatorChain.findDifferences(DatabaseObjectComparatorChain.java:98)
        at liquibase.diff.compare.core.ColumnComparator.findDifferences(ColumnComparator.java:68)
        at liquibase.diff.compare.DatabaseObjectComparatorChain.findDifferences(DatabaseObjectComparatorChain.java:98)
        at liquibase.diff.compare.DatabaseObjectComparatorFactory.findDifferences(DatabaseObjectComparatorFactory.java:171)
        at liquibase.diff.core.StandardDiffGenerator.compareObjectType(StandardDiffGenerator.java:96)
        at liquibase.diff.core.StandardDiffGenerator.compare(StandardDiffGenerator.java:52)
        at liquibase.diff.DiffGeneratorFactory.compare(DiffGeneratorFactory.java:100)
        at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:149)
        at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:51)
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
        ... 4 more

noticed that the error occurs after running a query on [sys]. [Extended_properties]

SELECT CAST([ep].[value] AS [nvarchar](MAX)) AS [REMARKS]
  FROM [sys].[extended_properties] AS [ep]
 WHERE [ep].[class] = 1
   AND [ep].[major_id] = OBJECT_ID(N'[dbo].[Table]')
   AND [ep].[minor_id] = COLUMNPROPERTY([ep].[major_id], N'Column', 'ColumnId')
   AND [ep].[name] = 'MS_Description'

Thanks a lot for the help

Re : Unable to replace logger, ServiceLocator.instance() returns null

$
0
0
I have deployed the liquibase-core karaf feature https://github.com/steinarb/liquibase-karaf-feature to maven central.

The deployed feature has version 3.5.3 and will load liquibase 3.5.3 (and redirect the liquibase logs to the karaf logs).

To load the feature, type the following commands in the karaf console: https://github.com/steinarb/liquibase-karaf-feature#using-liquibase-from-a-karaf-feature

To depend on the liquibase-core feature from a karaf feature file, reference the liquibase-core feature repository before referencing the liquibase-core feature: https://github.com/steinarb/liquibase-karaf-feature#using-liquibase-from-a-karaf-feature

Re : Do not create Databasechangelog and Databasechangeloglock tables?

$
0
0
Hi prabharhar,

not sure what you mean with "it is kind of utility sql". If you just want to fire sql to a database, liquibase might not be the right tool for you. liquibase is meant to manage database changes across multiple invocations and they can only be tracked with some kind of metadata.
This is why Liquibase uses the two tables. One to prevent duplicate invocations, the other to track already applied changeLogs (so they are not applied twice). What you can do is to rename the tables and even put them in another schema/catalog but I don't think it's possible to skip them entirely (or keep the info only in the filesystem).

If your DBA does not accept that your only way to go may be preparing a test database (that allows the liquibase tables) and give the DBA a cleaned up version of the liquibase generated sql (the command would then be updateSQL instead of update).

Hope this helps.

Daniel

Re : Unable to replace logger, ServiceLocator.instance() returns null

H2 text column generation

$
0
0
Hi all,

I just upgraded from 2.0.5 to 3.5.3.  I've run into a problem I can't figure out.  We use Postgres in production, and H2 in dev.  Generating a fresh dev DB with a changelog like this:

<changeSet author="tnelson" id="20017-0013">
<addColumn tableName="calllistitem">
<column name="summary" type="text" />
</addColumn>
</changeSet>

When hibernate validates the mapping, I get this exception with H2.
org.hibernate.HibernateException: Wrong column type in TEST.PUBLIC.CALLLISTITEM for column summary. Found: clob, expected: longvarchar

Everything seems to work fine with Postgres.

I've tried multiple ways of configuring hibernate, but I really think hibernate is right, this column should really be longvarchar, not clob.

Since this only affects dev, I'm happy to write a changeset to change all the types in H2, but I'm not even sure what I'd specify the new type as.

Is there an easy way to tell configure liquibase to use longvarchar when creates a column of type text?

Is there a better solution?

Thanks
Tony

Possible to disable reorg table command on DATABASECHANGELOG and DATABASECHANGELOGLOCK?

$
0
0
Hello,

We are using Liquibase on DB2 for our database with column-organized tables. One thing with column-organized table is that you are not allowed to run "reorg table", it is taking care by the database itself. Running reorg table will result with db2 throwing an error. 

SQL1667N  The operation failed because the operation is not supported with the 

type of the specified table.  Specified table: "DATABASECHANGELOG".  Table 

type: "ORGANIZE BY COLUMN".  Operation: "REORG TABLE".  SQLSTATE=42858


Is it possible to disable the execution of reorg table on the two tables?

Or

Maybe provide an option to create the two table with "ORGANIZED BY ROW" which will allow the "reorg table" command. Without specify how the table is organized, the create table command will default to whatever the database is configured to, which is "organized by column".

Thank you.

Can liquibase point to a directory and sync/run sql files within?

$
0
0

For our project we currently commit all database changes as .sql files to a given svn directory. I want to set up liquibase so that when we need to do an alpha push, I run a single liquibase command and it will check our sql directory for new files, if there are new files run them on the alpha database thus syncing dev and alpha.

Is this possible? Or do I have to update alpha manually via the changelogs and such?

Re : Support for Hive (Hadoop) schema changes via Liquibase?

$
0
0
Hi,

I've been trying to understand the codebase for sometime to see whether it is possible to make use of liquibase to handle schema changes for Impala/Hive. At first glance, come to know that CRUD operations are happening on two important tables - 1. databasechangeloglock 2. databasechangelog as it is heavily used to persist the state. 

Hive/Impala doesn't have ACID support - No Transactional support, No CRUD support in my distribution although there is support (but not as full fledged feature) in general community version. Thought of sharing this info and asking for your suggestions. Thoughts? Is anyone trying out this?

Is it possible to keep these core tables somewhere outside in RDBMS (for ex, mysql) as common place for all Hive/Impala databases? Yes, there could be problems in maintain the integrity between these two operations.

Thanks,
Mani

Liquibase and derby gives: Error closing derby cleanly

$
0
0
Hi,

I'm trying to set up derby together with maven and and liquibase. I want to create an embedded derby database and a table and it works but then when it's finished i get a database exception that states that derby couldn't be closed cleanly.
This locks the database so no one can connect to it.

Does anyone know anything about this problem?
What can I do to make sure Derby closes cleanly?

Maven version 4.0.0
Liquibase 5.3.5
Derby 10.13.1.1

<build>
    <plugins>
      <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>3.5.3</version>
        <configuration>
            <changeLogFile>src/main/resources/release/changelog/changelog.xml</changeLogFile>
            <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
            <url>jdbc:derby:target/db/test;create=true</url>
            <defaultSchemaName>test</defaultSchemaName>
            <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
        </configuration>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                    <goal>updateSQL</goal>
                </goals>
            </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  
  <dependencies>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
    </dependency>
  </dependencies>

How to unlock / release files?

$
0
0
I'm trying to use Liquibase programmatically, but I'm running into an issue with file locks.  It seems like Liquibase is keeping the changelog files open after it's done using them, and I can't figure out how to close them.  I did some searching around on the internet and couldn't find anything.  I assume this means the fix is really simple and easy and obvious, and I must be just missing it.  So how do I make Liquibase release filelocks when running changelog sets programmatically?

Performance issue if a changeset contain a single insert statement with multiple values.

$
0
0
I am currently on liquibase version 3.5.3. I have a .sql file with a changeset that contains a single "insert into table" statement with multiple values. i have observed that insert statements with multiple values work fine if they are not too large. but in my case i have a insert query inserting 6000 rows (apx. 700000 characters long query) within the single statement. like given below 
  1. insert into mytable (col1, col2) values 
  2. ('val1', 'val2'),
  3. ('val3', 'val4'),
  4. ('val5', 'val5'),
  5. ...and so on upto 6000 lines and total apx. 700000 characters.
above scenario takes atleast 80 seconds to execute the changeset. this is a problem for me since we have a timeout of 60 seconds in our cloud instance for any deployment to complete. i had debug the liquibase source code and identified that the below method is a culprit
  1. liquibase.util.StringUtils.processMutliLineSQL(String, boolean, boolean, String)
For now i had to split my insert statements to accomodate not more than 200000 characters in a single sql query. but this could again be a problem for me in future. 

CORE-3008: includeAll uses full file path with 3.5.3 version

$
0
0
If we have relative path in includeAll (eg: <includeAll path="../y"/>) then absolute path is entered in FILENAME column of DATABASECHANGELOG table as of 3.5.3 version and this issue is blocking us from uptaking this version.

Please find attached the test case.

I tried to make a change in FileSystemResourceAccessor#list method. Could you please review if this is the way to go?
  1. diff --git a/liquibase-core/src/main/java/liquibase/resource/FileSystemResourceAccessor.java b/liquibase-core/src/main/java/liquibase/resource/FileSystemResourceAccessor.java
    index cfdbfb8..2750a19 100644
    --- a/liquibase-core/src/main/java/liquibase/resource/FileSystemResourceAccessor.java
    +++ b/liquibase-core/src/main/java/liquibase/resource/FileSystemResourceAccessor.java
    @@ -138,6 +138,9 @@ public class FileSystemResourceAccessor extends AbstractResourceAccessor {
                             break;
                         }
                     }
    +                if(this.baseDirectory == null){
    +                    returnPath = returnPath.substring(returnPath.lastIndexOf(path));
    +                }
                     finalReturnSet.add(returnPath);
                 }
                 return finalReturnSet;

Re : Support for Hive (Hadoop) schema changes via Liquibase?

$
0
0
Hi Mani,

I've develop the plugin you mention above, you can try it https://github.com/eselyavka/liquibase-impala. This plugin support Hive and Impala. I believe that there are a lot of areas where we can improve this plugin, but basic tests looks good for me at this moment. In case your find a bug please create an PR on this or address this issue to me.

Re : Support for Hive (Hadoop) schema changes via Liquibase?

$
0
0
Thanks for your reply. I will try using the extension and would like to understand the flow as well. Will update on this.

Liquibase 3.5.3 runs ALTER USER on update

$
0
0
I upgraded to Liquibase 3.5.3. We use SqlServer. I see this error during update:

Unexpected error running Liquibase: Cannot alter the user '<domain>david.raskin', because it does not exist or you do not have permission. [Failed SQL: IF USER_NAME() <> N'dbo'

BEGIN
        DECLARE @sql [nvarchar](MAX)
        SELECT @sql = N'ALTER USER ' + QUOTENAME(USER_NAME()) + N' WITH DEFAULT_SCHEMA = [ccf]'
        EXEC sp_executesql @sql
END]

Previous version of Liquibase did not give this error or probably didn't run this SQL in the beginning.

Is there a way to disable this?

thanks!

Liquibase 3.5.3 ORA-28040 while connecting to 12c database

$
0
0
I have an issue with connecting with Liquibase 3.5.3 to Oracle 12c. I receive this error: "ORA-28040: No matching authentication protocol" no matter what.

The connection to 11g is working flawlessly but to 12c it's not. I have tried ojdbc 6-7-8-14 driver too, and I have tried with property file and call Liqueibase directly with commands only but same error.


Commands

liquibase 

--driver=oracle.jdbc.OracleDriver 

--classpath=C:/liquibase-3.5.3-bin/lib/ojdbc7.jar 

--url="jdbc:oracle:thin:@123.123.123:1111/SERVICE_NAME" 

--username="FAKE_USERNAME" 

--password="FAKE_PASSWORD"

--changeLogFile=C:/FAKE_PATH/db-changelog-master.xml 

--logLevel=DEBUG 

--contexts="FAKE_CONTEXTS" updateSQL > script.sql  

-DinsertCondition=FAKE -DnwuCondition=FAKE


liquibase.properties

classpath: lib\\ojdbc8.jar

driver: oracle.jdbc.OracleDriver

url: jdbc:oracle:thin:@123.123.123:1111/SERVICE_NAME

username: FAKE

password: FAKE

changeLogFile: C:\\FAKE\\db-changelog-master.xml


Anybody could suggest anything regarding to this?


Respons in cmd:
SEVERE 9/6/17 4:34 PM: liquibase: java.sql.SQLException: ORA-28040: No matching authentication protocol

liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.sql.SQLException: ORA-28040: No matching authentication protocol

        at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:127)
        at liquibase.integration.commandline.Main.doMigration(Main.java:958)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.exception.DatabaseException: java.sql.SQLException: ORA-28040: No matching authentication protocol

        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
        at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
        at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:85)
        ... 3 more
Caused by: java.sql.SQLException: ORA-28040: No matching authentication protocol

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
        at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:295)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:454)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:802)
        at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:239)
        ... 5 more

are all object types covered by Liquibase?

$
0
0
Hello,
Oracle Database 12c, Liquibase 3.5.3
Packages, triggers and materialized views are seemingly not supported by Liquibase. Is this correct?
What other Oracle object types are not supported by Liquibase?

Thank you

Re : are all object types covered by Liquibase?

$
0
0
You are correct. There are a number of Oracle objects simply not supported in Liquibase. You have a few options.

The first is to use the Oracle extension (https://github.com/liquibase/liquibase-oracle). The second is to add support to the that for objects that are not available.

The third option is to use Datical. We've added support for a large number of these objects. Beyond that, Datical has Forecast support (generate a Report without changing the target database) and a Rule Engine (enforce SQL best practices and other things like "no more than X indexes on a table" and "no foreign keys without indexes on the columns in FK"). Datical supports Liquibase in Development and using Datical at the build server and in automation tooling. 

Hope that helps! Thanks for using Liquibase!

Robert

should it be update.xml instead of install.xml

$
0
0
http://www.liquibase.org/tutorial-using-oracle

What is written write now

As you can see above, after the installation of 1.x, we run the updates from 1.x to the latest version. You may wonder: why not include the update at the end of the install.xml file as: <include file="v001/master.xml" /> ? That would be equally valid. However, for some reason, if we do that then the precondition in master.xml fails.



What may be intended

As you can see above, after the installation of 1.x, we run the updates from 1.x to the latest version. You may wonder: why not include the update at the end of the update.xml file as: <include file="v001/master.xml" /> ? That would be equally valid. However, for some reason, if we do that then the precondition in master.xml fails.
Please let us know
Thank you

step 11 on tutorial using Oracle

$
0
0
Hello,
http://www.liquibase.org/tutorial-using-oracle

As a part of Step11 we are asked to run step 5.1 to 5.5.
Step 5.1
C:\others\liquiwork\lbdemo\trunk\v001\master.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
    <preConditions>
        <!-- These changes should only be run against a schema with major version 1 -->
        <sqlCheck expectedResult="1">
            SELECT NVL(MAX(id),0)
            FROM databasechangelog
            WHERE author='MajorVersion'
        </sqlCheck>
    </preConditions>
    <include file="v001/2009-10-16-102.xml"/>
    <include file="v001/2009-10-16-105.xml"/>
        <!-- Do not include any more changes in this file -->
    <changeSet author="MajorVersion" id="1" />

</databaseChangeLog>

The blue font is what I added to C:\others\liquiwork\lbdemo\trunk\v001\master.xml. This is step 11(repeat of step 5.1) in progress.

C:\others\liquiwork\lbdemo\trunk>Liquibase --changeLogFile=update.xml update
Liquibase Update Successful

Is this correct? Is the id tag supposed to be 2 in the changeSet element?
Could you please explain what needs to be done (to repeat process of step 5) to finish step 11?
If you could please explain Step 11 to 17 briefly, this could help me. 
Is lb_upgrade_to_major required to be run only on step 17? Is lb_upgrade_to_major not required to be run at all before step 17?



Thank you
Viewing all 1169 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>