Migração Fácil para PostgreSQL

O Migration Toolkit da EnterpriseDB permite migração de diversos Sistemas Gerenciadores de Bancos de Dados (Oracle, Sybase, SQL Server, MySQL) para PostgreSQL.

Na verdade minha maior necessidade no momento é uma migração de MySQL para PostgreSQL, mas enquanto não acerto a string de conexão java com o MySQL, executei este teste no Oracle.

Para que a migração funcione, basta editar o arquivo toolkit.properties com os bancos de origem e destino.

C:Program Files (x86)PostgresPlusEnterpriseDB-MigrationToolkit>runMTK.bat HR
Source database connectivity info...
conn =jdbc:oracle:thin:@localhost:1521:ORCL
user =HR
password=******
Target database connectivity info...
conn =jdbc:postgresql://localhost:5432/postgres
user =postgres
password=******
Connecting with source Oracle database server...
Connecting with target Postgres database server...
Importing redwood schema HR...
Creating Schema...hr
Creating Sequence: DEPARTMENTS_SEQ
Creating Sequence: EMPLOYEES_SEQ
Creating Sequence: LOCATIONS_SEQ
Creating Tables...
Creating Table: COUNTRIES
Creating Table: DEPARTMENTS
Creating Table: EMPLOYEES
Creating Table: JOB_HISTORY
Creating Table: JOBS
Creating Table: LOCATIONS
Creating Table: REGIONS
Created 7 tables.
Loading Table Data in 8 MB batches...
Loading Table: COUNTRIES ...
[COUNTRIES] Migrated 25 rows.
[COUNTRIES] Table Data Load Summary: Total Time(s): 0.125 Total Rows: 25
Loading Table: DEPARTMENTS ...
[DEPARTMENTS] Migrated 27 rows.
[DEPARTMENTS] Table Data Load Summary: Total Time(s): 0.031 Total Rows: 27
Loading Table: EMPLOYEES ...
[EMPLOYEES] Migrated 107 rows.
[EMPLOYEES] Table Data Load Summary: Total Time(s): 0.063 Total Rows: 107 Total Size(MB): 0.0087890625
Loading Table: JOB_HISTORY ...
[JOB_HISTORY] Migrated 10 rows.
[JOB_HISTORY] Table Data Load Summary: Total Time(s): 0.047 Total Rows: 10
Loading Table: JOBS ...
[JOBS] Migrated 19 rows.
[JOBS] Table Data Load Summary: Total Time(s): 0.031 Total Rows: 19
Loading Table: LOCATIONS ...
[LOCATIONS] Migrated 23 rows.
[LOCATIONS] Table Data Load Summary: Total Time(s): 0.032 Total Rows: 23 Total Size(MB): 9.765625E-4
Loading Table: REGIONS ...
[REGIONS] Migrated 4 rows.
[REGIONS] Table Data Load Summary: Total Time(s): 0.016 Total Rows: 4
Data Load Summary: Total Time (sec): 0.514 Total Rows: 215 Total Size(MB): 0.01
Creating Constraint: REG_ID_PK
Creating Constraint: LOC_ID_PK
Creating Constraint: DEPT_ID_PK
Creating Constraint: JOB_ID_PK
Creating Constraint: EMP_EMP_ID_PK
Creating Constraint: EMP_EMAIL_UK
Creating Constraint: JHIST_EMP_ID_ST_DATE_PK
Creating Constraint: COUNTRY_C_ID_PK
Creating Constraint: LOC_C_ID_FK
Creating Constraint: COUNTR_REG_FK
Creating Constraint: DEPT_LOC_FK
Creating Constraint: JHIST_DEPT_FK
Creating Constraint: EMP_DEPT_FK
Creating Constraint: JHIST_JOB_FK
Creating Constraint: EMP_JOB_FK
Creating Constraint: JHIST_EMP_FK
Creating Constraint: EMP_MANAGER_FK
Creating Constraint: DEPT_MGR_FK
Creating Constraint: EMP_SALARY_MIN
Creating Constraint: JHIST_DATE_INTERVAL
Creating Index: EMP_NAME_IX
Creating Index: EMP_DEPARTMENT_IX
Creating Index: JHIST_DEPARTMENT_IX
Creating Index: DEPT_LOCATION_IX
Creating Index: LOC_COUNTRY_IX
Creating Index: JHIST_EMPLOYEE_IX
Creating Index: JHIST_JOB_IX
Creating Index: EMP_JOB_IX
Creating Index: LOC_CITY_IX
Creating Index: LOC_STATE_PROVINCE_IX
Creating Index: EMP_MANAGER_IX
Creating View: EMP_DETAILS_VIEW

Schema HR imported successfully.

Migration process completed successfully.

Migration logs have been saved to C:UsersProni.enterprisedbmigration-toolkitlogs

******************** Migration Summary ********************
Sequences: 3 out of 3
Tables: 7 out of 7
Constraints: 20 out of 20
Indexes: 11 out of 11
Views: 1 out of 1

Total objects: 42
Successful count: 42
Failure count: 0

*************************************************************

C:Program Files (x86)PostgresPlusEnterpriseDB-MigrationToolkit>type toolkit.properties
SRC_DB_URL=jdbc:oracle:thin:@localhost:1521:ORCL
SRC_DB_USER=HR
SRC_DB_PASSWORD=HR

TARGET_DB_URL=jdbc:postgresql://localhost:5432/postgres
TARGET_DB_USER=postgres
TARGET_DB_PASSWORD=Nerv2011

C:Program Files (x86)PostgresPlusEnterpriseDB-MigrationToolkit>

2 comments

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.