Enterprise DB provide a tool (Migration Toolkit) that allow you to migrates database from MySQL to PostgreSQL
Before running this script, you must have a config file filled with information regarding the source and destination DB:
/opt/PostgresPlus/9.0AS/etc/toolkit.properties
SRC_DB_URL=jdbc:mysql://orig-server.com:3306/orig_db SRC_DB_USER=root SRC_DB_PASSWORD=***** TARGET_DB_URL=jdbc:postgresql://dest-server.com:5432/dest_db TARGET_DB_USER=postgres TARGET_DB_PASSWORD=********
Then, in the binary folder from your enterpriseDB install (/opt/PostgresPlus/9.0AS/bin), run the runMTK.sh script with the following parameter:
[root@test bin]# ./runMTK.sh -sourcedbtype mysql -targetdbtype postgres orig_db
Some information will be displayed :
Source database connectivity info... conn =jdbc:mysql://orig-server.com:3306/orig_db user =root password=****** Target database connectivity info... conn =jdbc:postgresql://dest-server.com:5432/dest_db user =postgres password=****** Connecting with source MySQL database server... Connecting with target Postgres database server... Importing mysql schema orig_db... Creating Schema...orig_db Creating Tables... Creating Table: table1 Creating Table: table2 Creating Table: table3 Created 3 tables. Loading Table Data in 8 MB batches... Loading Table: table1 ... [table1] Migrated 12 rows. [table1] Table Data Load Summary: Total Time(s): 0.115 Total Rows: 12
Loading Table: table2 ... [table2] Migrated 4 rows. [table2] Table Data Load Summary: Total Time(s): 0.075 Total Rows: 4
Loading Table: table3 ... [table3] Migrated 19 rows. [table3] Table Data Load Summary: Total Time(s): 0.049 Total Rows: 19
Total Size(MB): 9.765625E-4
Data Load Summary: Total Time (sec): 0.414 Total Rows: 35 Total Size(MB): 0.0010 Creating Constraint: PRIMARY Creating Constraint: PRIMARY Creating Constraint: PRIMARY Schema orig_db imported successfully. Migration process completed successfully. Migration logs have been saved to /root/.enterprisedb/migration-toolkit/logs ******************** Migration Summary ******************** Tables: 3 out of 3 Constraints: 3 out of 3 Total objects: 6 Successful count: 6 Failure count: 0 *************************************************************
Thanks! Worked!
ReplyDelete