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

Re : Create tablespace in oracle

$
0
0
Can you include more of the changelog? From the error message, it appears you just don't have properly formed xml. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Create tablespace in oracle

$
0
0
Thank you Steve for the response. my file is as below

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

<changeSet author="KDBAS" id="1">
<preConditions onFail="CONTINUE">
<and>
<sqlCheck expectedResult="1">select count(*) from v$database where name like '%ATG%'</sqlCheck>
<sqlCheck expectedResult="0">select count(*) from dba_tablespaces  where tablespace_name like  '%schema1_DATA'</sqlCheck>
<sqlCheck expectedResult="0">select count(*) from dba_tablespaces  where tablespace_name like  '%schema2_DATA'</sqlCheck>
</and>
</preConditions>

<property name="dbname1" value="sit1" dbms="oracle" />
<property name="dbname2" value="sit2" dbms="oracle"/>


<sql>
create tablespace schema1_data datafile '/u01/app/oracle/oradata/"${dbname1}"/schema1_liquibase.dbf' size 1G ;
CREATE TABLESPACE schema2_DATA DATAFILE '/u01/app/oracle/oradata/"${dbname1}"/schema2_liquibase.dbf' size 1g;

create tablespace schema1_data datafile '/u01/app/oracle/oradata/"${dbname2}"/schema1_liquibase1.dbf' size 1G ;
CREATE TABLESPACE schema2_DATA DATAFILE '/u01/app/oracle/oradata/"${dbname2}"/schema2_liquibase.dbf' size 1g;


</sql>

</changeSet>
</databaseChangeLog>

Re : Create tablespace in oracle

$
0
0
You cannot have <property> tags inside a changeset - these need to be 'up' a level, so they are outside any changeset. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Create tablespace in oracle

$
0
0
Thank you Steve for the syntax correction.

I have updated the xml file and executed the same. The liquibase was successful but the tablespace was not created.


$  liquibase --changeLogFile=/exports/atgtest/aeoadmin_scripts/update_atgncat.xml --defaultsFile=/exports/atgtest/liquibase-atgtest.properties upda
Liquibase Update Successful



The code is a below

<property name="dbname1" value="sit1" dbms="oracle" />


<changeSet author="KantamnenS" id="1">
<preConditions onFail="CONTINUE">
<and>
<sqlCheck expectedResult="1">select count(*) from v$database where name like '%SIT%'</sqlCheck>
<sqlCheck expectedResult="0">select count(*) from dba_tablespaces  where tablespace_name like  '%ATGCORE_DATA'</sqlCheck>
</and>
</preConditions>


<sql>
create tablespace atgcore_liquibase datafile '/u01/app/oracle/oradata/"${dbname1}"/atgcore_liquibase1.dbf' size 1G ;


</sql>

</changeSet>
</databaseChangeLog>

Re : Is "NOT FOR REPLICATION" constraint supported in Liquibase ?

$
0
0
Hi Mr. Steve Donie, thank's for your response. I think also that this constraint is not supported with "mssql", because I searched a lot for a lot a solution with no luck.

Re : Create tablespace in oracle

$
0
0
In order to diagnose this, you would need to look at the DATABASECHANGELOG table to see if the changeset was actually deployed or not - it may be that the preconditions prevented it from running. You could also run the command with --logLevel=debug and see what the log files show is happening. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Create tablespace in oracle

$
0
0
Thank you Steve .
The --logLevel=debug helped me to resolve the issue.
I was using "${dbname1}" where I don't need the double quotes so i used ${dbname1}.

Adding User Name to the sql tag for Oracle

$
0
0
Is there some way to prefix table names with the user name in sql tags so that the generated sql would have the user name?

Liquibase supported tags work

eg.
    <changeSet author="john" id="4331-1" dbms="oracle">
        <dropUniqueConstraint tableName="user_type" constraintName="uk_user_type"/>
    </changeSet>
generates
    ALTER TABLE service_account.user_type DROP CONSTRAINT uk_user_type DROP INDEX;
   
However,
    <changeSet author="john" id="4331-2" dbms="oracle">
        <sql>
            alter table user_type drop constraint uk_user_type
        </sql>
    </changeSet>
generates    
    alter table user_type drop constraint uk_user_type
   
Is there some variable prefix I can add to the sql statement that would get substituted with the user name in Oracle?       
eg.   
    <sql>
        ${db.username}.alter table user_type drop constraint uk_user_type
    </sql>

I export the sql so the DBA can run it and they insist (correctly) that the schema name has to be prefixed on all the statements.  They run it as a DBA and these statements fail with table or view does not exist.  At the moment, I'm exporting the sql and then manually searching for statements like this (which is difficult) and then running them.

I'm not sure of this is already supported or not.  Alternatively, if you could point me to some way to do this, that would be awesome.

Thanks

liquibase:diff command throws Null pointer exception

Failed to read schema document 'http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd'

$
0
0
hi 
 we are getting the " Failed to read schema document 'http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>." error  while running the application.

not able to create database schema.
previously it was working, suddenly it start giving error.

i have attach the change log file.

please suggest some solution to sort out this issue


thanks  

Re : Failed to read schema document 'http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd'

$
0
0
Looks like it might have been something transient - I am able to see the xsd file fine from here. Try opening that link in a browser - you should see a valid xsd file (which is also an xml file).

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Precondition evaluation in updateTestingRollback

$
0
0

Hi, all.

When executing the "updateTestingRollback" goal, is the precondition of a changeset evaluated just once (before the first update) or twice (before each of the two updates)?


Example

  1. <changeSet author="me" id="01">
  2. <preConditions onFail="MARK_RAN">
  3. <sqlCheck expectedResult="0">
  4. select count(*) from USERS WHERE ID = 1;
  5. </sqlCheck>
  6. </preConditions>
  7. <sql>
  8.    INSERT INTO USERS VALUES (1, "JOHN", "SMITH", ....);
  9.    INSERT INTO USERS VALUES (2, "MARY", "SHELLEY", ....);
  10. </sql>
  11. <rollback>
  12.    DELETE FROM USERS WHERE ID = 2;
  13. </rollback>
  14. </changeSet>

First Update
Check if exists a record with ID = 1, if not exists then insert two rows

Rollback
Delete only the second row (the one with id =2)

Second Update
Is the precondition re-checked?
If so, the sql block is not called; otherwise it gets called, throwing an error (duplicated key).


I know that in this example i'm not doing right with the rollback (it shoould delete two rows), but please take it just as an example in order to have a confirmation about the way it's expected to work.


Wierd things with checksums

$
0
0
So we had a dropwizard application that was using liquibase. We ported that application to springboot and moved over the .xml file and ran it.

We got an

oracle.jdbc.OracleDatabaseException: ORA-00955 exception when running our code so apparently liquibase was trying to run our set.

We looked into the DATABASECHANGELOG and saw that the paths for the file didn't match, so we resynced everything with running the changelogSync command and it generated new entries for us with correct FILENAMES.

when running the code again we still get the same fault:

oracle.jdbc.OracleDatabaseException: ORA-00955

When debugging we can see the following, it generates a MD5 out of our xml, then it generates an MD5 out of the already generated MD5 in the database!?


Log:

  1. 2019-02-15 16:22:42.158 DEBUG 51968 --- [           main] liquibase.util.MD5Util                   : Computed checksum for createTable:[
  2.     columns=[
  3.         [
  4.             [
  5.                 nullable="false"
  6.                 primaryKey="true"
  7.             ]
  8.             name="LOAN_COLLECTION_ID"
  9.             type="varchar(56)"
  10.         ],
  11.         [
  12.             [
  13.                 nullable="false"
  14.             ]
  15.             name="ZIP_CODE"
  16.             type="varchar(6)"
  17.         ],
  18.         [
  19.             [
  20.                 nullable="true"
  21.             ]
  22.             name="BANK_NAME"
  23.             type="varchar(56)"
  24.         ],
  25.       ... [truncated in log] as 6655e2c8d7983a338d41895acba0b208
  26. 2019-02-15 16:22:42.160 DEBUG 51968 --- [           main] liquibase.util.MD5Util                   : Computed checksum for 8:6655e2c8d7983a338d41895acba0b208: as 97e4d04847a5754a05595ac8cdf76cd8
the checksum generated and the checksum in the database seems to be the same, (except for the 8 in the beginning). I have no idea...

help...

To use something close to "include"

$
0
0
I have a set of "property" lines for each database schema and want to use them depending on schema name. I created several ".SQL" files and tried using <include> tag in changelogs - this does not work, "include" triggers script execution and expects database commands. Is there a way to have various files setting properties and add them to changelog through something close to "include" command or to "source" UNIX command?

Errors during

$
0
0
Hi all,

We are facing the below error for one of the schema, whenever we check-in a new change.
As of now we are facing the issue on 2 schemas.
Please let us know what is causing this.



Unexpected error running Liquibase: Unknown Reason

SEVERE 2/26/19 9:32 AM: liquibase: Unknown Reason
java.lang.NullPointerException
at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChangeLogHistoryService.java:118)
at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1076)
at liquibase.Liquibase.update(Liquibase.java:205)
at liquibase.Liquibase.update(Liquibase.java:192)
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)

Re : Errors during

$
0
0
What version of liquibase are you using? Has this worked before? If so, what has changed since it worked? When you run the command, what log level are you using? If you are using anything less than DEBUG, can you re-run the command with it set at DEBUG and share the results?

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Wierd things with checksums

Weird behaviour using liquibase:diff

$
0
0
Hi all, would appreciate some help regarding this issue. 

Upon running mvn liquibase:diff, I'm seeing weird behaviour where uniqueConstraints are being dropped then added again

<changeSet id="1551265617054-1">
    <dropUniqueConstraint constraintName="uk_email_user" tableName="user"/>
    <addUniqueConstraint columnNames="email" constraintName="uk_email_user" tableName="user"/>
 </changeSet>
 <changeSet id="1551265617054-2">
    <dropUniqueConstraint constraintName="uk_login_user" tableName="user"/>
    <addUniqueConstraint columnNames="login" constraintName="uk_login_user" tableName="user"/>
 </changeSet>

I'm using liquibase version 3.6.3 with liquibase-hibernate5 version 3.6.

@Entity

@Table(name = "user", uniqueConstraints = {

        @UniqueConstraint(name = "uk_login_user", columnNames = { "login" }),

        @UniqueConstraint(name = "uk_email_user", columnNames = { "email" })

})

public class User {


    @Id

    @GeneratedValue(strategy = GenerationType.IDENTITY)

    private Long id;


    @NotNull

    @Pattern(regexp = Constants.LOGIN_REGEX)

    @Size(min = 1, max = 50)

    @Column(length = 50, nullable = false)

    private String login;


    @Email

    @Size(max = 100)

    @Column(length = 100)

    private String email;


}


Re : Errors during

$
0
0
Liquibase version is 3.4.2 . Yes it has worked before
No changes done recently. we run the deployments  through a tool -bamboo , not sure if it uses the DEBUG options.

Liquibase trying to deploy file which is removed

$
0
0
We had deployed a change in 2 environments 
But later needed to change something  removed the changelog files so that it won't get deployed in all the environments
Still it had checked-in 3rd environment, I have removed the file in my local repository and deployed again
But still in the 3rd environment , it is still checking for the file which was removed.

Error: ORA-00933: SQL command not properly ended\n [Failed SQL: CREATE SEQUENCE SEQ_ROW MINVALUE 1 MAXVALUE 9999999 INCREMENT BY 1 START WITH 1000001 NOCACHE NOORDER NOCYCLE NOPARTITION]\nliquibase.exception.DatabaseException: ORA-00933: SQL command not properly ended\n [Failed SQL: CREATE SEQUENCE SEQ_ROW MINVALUE 1 MAXVALUE 9999999 INCREMENT BY 1 START WITH 1000001 NOCACHE NOORDER NOCYCLE NOPARTITION]\n\tat liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:301)\n\tat liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)\n\tat liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107)\n\tat liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1251)\n\tat
Viewing all 2993 articles
Browse latest View live


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