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.
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
Related
Using the community edition of Liquibase for our snowflake instances.
Running the diffChangeLog command generates a script with only Tables listed. Stored Procedures and Views are totally ignored.
Surely this isn't right.
As per the section "Output" near the bottom of this page: https://docs.liquibase.com/commands/community/diffchangelog.html it states:
The diffChangeLog command produces a list of all Objects and creates a changelog with a list of changesets.
Liquibase Community diffChangeLog categories:
Catalog
Column
Foreign Key
Index
Primary Key
Schema
Sequence
Procedure
Unique Constraints
View
Is there a bug?
I've downloaded and copied the latest jar files (liquibase-snowflake-4.4.1 and snowflake-jdbc-3.9.2).
This is because Snowflake database does not fully support all the liquibase commands.
If you see the note below, it says: Note: Not all database platforms support all stored logic types that are listed. and Snowflake is one of them.
We are using Sybase 8 and Sybase 16 databases in our current project. I have a requirement where I need to script the a complete Sybase database(with some built-in data in certain tables) with Sybase scripting tools. For example, if I run a Sybase script, it would create a Sybase database for me. I tried using the combination of Dbunload (to create a dump), dbinit (to create a new db) and dbisql (to add data to database) commands but am not able to get at it. Require help regarding this from any Sybase db administrator in this forum.Thanks.
If you want to use a complete tool to generate the DDLs then you can use PowerDesigner for example.
If you want to write your own scripts in T-SQL or Watcom SQL what create the DDL scripts then you can also do this. All information about table schema is available in system tables. The full description of columns is also available in the documentation of SQL Anywhere.
is it possible to migrate data from one database table into another database table using liquibase?
Now we are running liquibase changesets on two different databases as we have two executions in pom maven file. But is it possible to write one changeset which selects data from one database table and copies to another database table?
You could use your preferred scripting language to query the data from the table and generate insert statements with the result. Once you have the insert statements, put them in a liquibase formatted sql file. and run them on your target database.
The goal is to have already created the files when the data was originally inserted. If your database already existed before you started using liquibase, then it may be a good idea to restore from a backup taken from the day you started using liquibase and sync it from there.
I have more than 2000 tables in my existing database.
I want generateChangeLog for all tables with structure and data.
I have tried using liquibase command but it is failed for all tables.
Is it possible in datical (Enterprise version of liquibase) with GUI or command ?
Liquibase command:
liquibase --driver=com.mysql.jdbc.Driver --classpath=mysql-connector-java-commercial-5.0.8-bin.jar --changeLogFile=D:\newLiquibse\xml\XYZ.xml
--url="jdbc:mysql://localhost:4928/MyDBName?zeroDateTimeBehavior=convertToNull" --username=XYZ --password=XYZ --diffTypes="tables, columns, views, primaryKeys, indexes, foreignKeys, sequences, data" generateChangeLog
I am using Liquibase 3.3.5 version.
Any help would be appreciated.
We're looking to migrate from MSSQL to Postgres. I'm intending on using sql servers bcp tool for generating csv that we'll import into postgres with the bulk copy features. We are however, having trouble getting the DDL migrated. We've. I've gotten it to work by massaging the DDL generated by MMSQL by hand but We need something automated since we have a moving target (still adding tables, columns etc.) and will need to do this more than once.
We're open to commercial and open source products but have not found anything that does everything we need: Tables, serial columns, indexes (unique, multi column etc), defaults and foreign key constraints.
Check this link http://dbconvert.com/convert-mssql-to-postgre-pro.php?DB=6
Specifically look at the "SQL Azure to PostgreSQL" feature. Hopefully that will handle your table DDL.
NOTE: I have not used this just ran across it at http://www.postgresql.org/ in the latest news section a few days ago.
Finally settled on using http://www.enterprisedb.com/products-services-training/products-overview/postgres-plus-solution-pack/migration-toolkit. It's the most thorough and does data and ddl. There have been some issues with escaping backslashes that are followed by numbers since postgres thinks these are unicode escape sequences.