PostgreSQL Migration Using MTK

Enterprisedb Migration Toolkit:

EDB Migration Toolkit is a powerful command-line tool that offers granular control of the migration process.
Migration Toolkit facilitates migration of database objects and data to an EDB Postgres Advanced Server (Advanced Server) or PostgreSQL database from:

  1. Oracle
  2. MySQL
  3. Microsoft SQL Server
  4. Sybase

which objects migrate to postgres

Oracle Objects:

  1. Schemas  
  2. Tables   
  3. List-Partitioned Tables        
  4. Range-Partitioned Table        
  5. Constraints  
  6. Indexes  
  7. Triggers        
  8. Table Data  
  9. Views    
  10. Materialized Views        
  11. Packages        
  12. Procedures  
  13. Functions      
  14. Sequences      
  15. Users/Roles  
  16. Profiles  
  17. Object Types  
  18. Object Type Methods  
  19. Database Links    
  20. Queues      

MySQL Objects:

  1. Schemas
  2. Tables
  3. Constraints
  4. Indexes
  5. Table Data

Microsoft SQL Server Objects:
  1. Schemas
  2. Tables
  3. Constraints
  4. Indexes
  5. Table Data
Sybase Objects:
  1. Schemas
  2. Tables
  3. Constraints
  4. Indexes
  5. Table Data
  6. Views

Install EDB-Migration Toolkit

Install Repository file and change repository username and password

yum -y install https://yum.enterprisedb.com/edbrepos/edb-repo-latest.noarch.rpm

vi /etc/yum.repos.d/edb.repo
[edb]
name=EnterpriseDB RPMs $releasever - $basearch
baseurl=https://ravirajdba92:KnjF6PGtfjrFmT2f@yum.enterprisedb.com/edb/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY

yum install edb-migrationtoolkit

MTK Tool Bin path =/usr/edb/migrationtoolkit/bin
MTK Tool configuration file path=/usr/edb/migrationtoolkit/etc

edit MTK configuration file for Oracle to Postgres Migration:

vi toolkit.properties 
SRC_DB_URL=jdbc:oracle:thin:@192.168.1.201:1521:pearl
SRC_DB_USER=mms
SRC_DB_PASSWORD=mms

TARGET_DB_URL=jdbc:edb://192.168.1.201:5444/edb
TARGET_DB_USER=enterprisedb
TARGET_DB_PASSWORD=post

edit MTK configuration file for MySQL to Postgres Migration:
change SRC_DB_URL only
jdbc:mysql://<host_name>[:<port>]/<database_id>

edit MTK configuration file for Sybase to Postgres Migration:
change SRC_DB_URL only
jdbc:jtds:sybase://<host_name>[:<port>]/<database_id>

edit MTK configuration file for  SQL Server to Postgres Migration:
change SRC_DB_URL only
jdbc:jtds:sqlserver:\<server_name>\[:<port>]\<database_id>

Download and paste the ojdbc file
[root@server1 lib]# pwd
/usr/edb/migrationtoolkit/lib
[root@server1 lib]# ll
-rwxr-xr-x. 1 root root  315292 Mar 10 03:29 commons-lang3-3.1.jar
-rwxr-xr-x. 1 root root  223779 Mar 10 03:29 edb-commons.jar
lrwxrwxrwx. 1 root root      48 Jul 23 10:06 edb-jdbc17.jar -> /usr/edb/migrationtoolkit/../jdbc/edb-jdbc17.jar
-rwxr-xr-x. 1 root root  483663 Mar 10 03:29 log4j-1.2.17.jar
-rwxrwxrwx. 1 root root 2739616 Jul 23 10:21 ojdbc6.jar

authentication and authorization for both server
Start Oracle listener and pg_hba.conf ipv4 entery for postgresql

Run EDB-Migration Toolkit

EDB-Migration Toolkit provide two types of migration

  • online Migration
  • offline Migration

online Migration: 

cd /usr/edb/migrationtoolkit/bin
 ./runMTK.sh -allSchemas

offline Migration:

./runMTK.sh -offlineMigration /home/oracle/muthu_migration.sql -allSchemas

import offline Migration:

su - enterprisedb
cd /opt/edb/as10/bin
./psql
edb=#\i /home/oracle/muthu_migration.sql

Comments

Post a Comment

Popular posts from this blog

PostgreSQL pg_pool-II Installation and Configuration

PostgreSQL Pages and Tuples