1

I have a scenario where we are migrating from Oracle DB to Postgres Sql, I know I can generate a change-log from Oracle schema using liquibase maven plugin and can use the same to create my schema in Postgres. What i want to know is if its possible to copy the data from oracle to postgresql too using liquibase. If so, how to do it.

Any help is much appreciated.

DEEPAK MURTHY
  • 13
  • 1
  • 5

1 Answers1

1

I'm not sure you can copy the data from one database to another using Liquibase changeSet directly.

But you can use generateChangeLog with --diffTypes=data attribute. It'll include data in the generated changeSets.

Check out the generateChangeLog docs

–diffTypes - List of diff types to include in changelog expressed as a comma separated list from: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints, data.

And also check out this example

liquibase   
        --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver  
        --classpath="C:\\Program Files\\Microsoft JDBC Driver 6.0 for SQL Server\\sqljdbc_6.0\\enu\\jre8"  
        --url="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2017;integratedSecurity=false;"
        --changeLogFile="D:\Source\generateChangeLog--PersonSchema.xml"
        --username=liquibase
        --password=liquibase@123
        --logLevel=info
        --defaultSchemaName=dbo
        --diffTypes=data
        generateChangeLog
htshame
  • 6,599
  • 5
  • 36
  • 56
  • Thank you @htshame. I tried your solution and it seems to be working. But i use maven and liquibase is inside our app so i run this command to generate the changelog with data. mvn liquibase:generateChangeLog -Dliquibase.diffTypes=data – DEEPAK MURTHY May 12 '20 at 15:54
  • Great, you're welcome! By Stackoverflow rules if the answer answers your question, you should accept it. – htshame May 12 '20 at 16:02