Very good blog here.
Ora2pg doc here.
-
First UNZIP the four files instantclient-***.zip in a COMMON instantclient_12_2 directory
- Zip files can be downloaded here (you need an Oracle account): Oracle Download
- Use
installInstantClient.sh
-
A docker-compose to create 3 containers
- a
source_host
container with a MYSQL database instance - the MYSQL database is initialised with 2 tables and few data (script in
./sourceDbInitScripts
directory) - a
destination_host
container with a PGSQL database instance (with no database in it) - a
migration
server container (ubuntu based) with all required dependencies to launchora2pg
tool
- a
To start: docker-compose up -d --remove-orphan
If you have issues: docker-compose stop
then docker system prune -f -a --volumes
(to clean absolutely everything)
-
Scripts in root directory
- first, use
./createMigrationProject.sh
(from the localhost) to launch ora2pg project creation from within the migration server. - second, use
./exportSchema.sh
(from the localhost) to export mySQL schema and transform it to PG schema. Results will arrive inscripts/projects/schema
directory on the migration server - then, use the interactive
./importDataInPg.sh
(from the localhost) to apply migration. You also can useimport_all.sh
(frommigration
container) to have more options- answer NO to create database and schema
- answer YES to create TABLEs
- answer YES to load DATA
- answer YES to apply INDEXES, then CONSTRAINTS, then FK/PK
- first, use
-
To check the result, use
docker-compose exec destination_host /bin/bash
to connect to the PGSQL container and thenpsql -d destination_db -U myDatabaseAdminUser
to connect to the database. You can then use\dt
to list tables andselect * from <table_name>
to check data. -
You can customize the migration configuration by editing
./scripts/projects/mig/ora2pg.conf
file.