Migrar de Oracle a MySQL empleando MySQL Migration Toolkit

Aviso: Este es un post de programacion y desarrollo con bases de datos y por tanto es un articulo bastante tecnico, puede que no te interese. No te preocupes, en este sitio hay variedad.

En este articulo comento como se puede migrar un esquema de base de datos de Oracle a MySQL. Para ello empleamos la utilidad MySql Migration Toolkit.

Los pasos son (como root):

* Descargarnos el fichero (a la hora de escribir esto mi version era: mysql-gui-tools-5.0r11-linux-i386.tar.gz)

mysql-gui-migration-toolkit.jpg

* Descomprimimos el fichero mysql-gui-tools-5.0r11-linux-i386.tar.gz

Y nos metemos dentro de la carpeta creada.

cd mysql-gui-tools-5.0

En ella, Hay dos utilidades que nos permiten por un lado administrar la base de datos MySQL y por el otro utilizar un cliente de SQL.

Vamos a ejecutar el administrador:

./mysql-administrator

* Al ejecutar nos da este error:


root@soledad:~/Desktop/mysql-gui-tools-5.0# ./mysql-administrator
Error starting ./mysql-administrator.
The actual installation path of mysql-administrator is different from the
expected one. Please run ./mysql-administrator --update-paths (as the root
user, if needed) to have the installation directory updated.

Pues como nos dice, Actualizamos los paths:


root@soledad:~/Desktop/mysql-gui-tools-5.0# ./mysql-administrator --update-paths
Updating mysql-administrator installation paths...
Done.

Lo lanzamos, y ahora si que nos muestra la ventana de login:

migration01.jpg

Desde esta utilidad podemos administrar toda la base de datos.

migration02.jpg

Si lo necesitas con este administrador puedes crear nuevos usuarios de la base de datos, asociarles una maquina/base de datos y gestionar los permisos. En el ejemplo se muestran los permisos asignados al usuario «jose» para el host «@soledad» y el esquema de base de datos «EVO»

migration31.jpg

Ejecutemos ahora el cliente SQL:


root@soledad:~/Desktop/mysql-gui-tools-5.0# ./mysql-query-browser

Con el cliente podemos lanzar consultas y scripts SQL:

clientemysql.jpg

Bien, esto solo era para ver un poco por encima estas herramientas adicionales.
Pasemos ahora a la buena, la encargada de migrar entre las bases de datos.

MIGRANDO LA BASE DE DATOS ORACLE A MYSQL

Nos cambiamos al directorio migration-tool-script que es donde se encuentra la utilidad de migracion:


cd migration-tool-script

Hay 2 versiones: run_migration (que emplea un interface grafico) y run_migration_simple (que usa la consola)

Ejecutamos la de terminal grafico:


root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ./run_migration
JRE not found. Please make sure JRE (1.6.0 recommended) is installed and update the ./run_migration script to point to the correct path

Nos da un error porque no encuentra el JRE, para solucinarlo, actualizamos el contenido del script run_migration pasando la ruta donde esta el JRE 1.6 (dependera de donde lo tengas instalado) y tambien indicandole, la ruta del fichero del fichero
libjvm.so en la siguiente linea:


export GRT_JVM_PATH="/usr/lib/jvm/java-6-sun/jre/lib/i386/server/libjvm.so":

En mi caso,Queda asi:


#!/bin/sh
# Change the following paths to your local installation of JRE 1.6
if test "x$JRE_LIB_BASE" = x; then
#JRE_LIB_BASE="/usr/java/jdk1.6.0/jre/lib//"
JRE_LIB_BASE="/usr/lib/jvm/java-6-sun/jre/lib//"
fi
if [ ! -d $JRE_LIB_BASE ]; then
echo "JRE not found. Please make sure JRE (1.6.0 recommended) is installed and update the $0 script to point to the correct path"
exit 1
fi
JRE_LIB_PATHS="$JRE_LIB_BASE:$JRE_LIB_BASE/server"
LD_LIBRARY_PATH="java:$JRE_LIB_PATHS:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
#export GRT_JVM_PATH="$JRE_LIB_BASE/server/libjvm.so"
export GRT_JVM_PATH="/usr/lib/jvm/java-6-sun/jre/lib/i386/server/libjvm.so"
./grtsh -x scripts/TextMigrationScript.lua

Lo ejecutamos ahora:


./run_migration

Y mas sorpresas…


root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ./run_migration
Opening script file lua/_textforms.lua ...
Executing script file lua/_textforms.lua ...
Execution finished.
Initializing migration environment...
Initialisation complete.
error executing script: scripts/TextMigrationScript.lua:1123: attempt to index global `dlg' (a nil value)
root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script#

Ocurre un Error, aqui no hay nada que hacer, es un Bug que todavia no esta solucionado (en Ubuntu, no podremos por tanto
emplear el Asistente grafico). Sin embargo la version de Windows si que funciona:

welcome-screen.png

No importa, usaremos la version simple, la del texto:

Lo mismo que antes. Editamos el fichero run_migration_simple y cambiamos path del JRE 1.6 y ruta de libjvm.so:


#!/bin/sh
# Change the following paths to your local installation of JRE 1.6
if test "x$JRE_LIB_BASE" = x; then
# JRE_LIB_BASE="/usr/java/jdk1.6.0/jre/lib//"
JRE_LIB_BASE="/usr/lib/jvm/java-6-sun/jre/lib//"
fi
if [ ! -d $JRE_LIB_BASE ]; then
echo "JRE not found. Please make sure JRE (1.6.0 recommended) is installed and update the $0 script to point to the correct path"
exit 1
fi
JRE_LIB_PATHS="$JRE_LIB_BASE:$JRE_LIB_BASE/server"
LD_LIBRARY_PATH="java:$JRE_LIB_PATHS:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
#export GRT_JVM_PATH="$JRE_LIB_BASE/server/libjvm.so"
export GRT_JVM_PATH="/usr/lib/jvm/java-6-sun/jre/lib/i386/server/libjvm.so"
#CLASSPATH="/home/jose/Desktop/mysql-gui-tools-5.0/migration-tool-script/ojdbc14.jar"
#export CLASSPATH
./grtsh -x scripts/MigrationScript.lua

Lo ejecutamos: ./run_migration_simple


root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ./run_migration_simple
MySQL Migration Toolkit - Script Version 1.1.9exp
-------------------------------------------------
Initializing migration environment...
Initialisation complete.
*******************************
* Source database connection. *
*******************************
Please choose a database system:
--------------------------------
1. MS Access
2. Generic Jdbc
3. MaxDB Database Server
4. MS SQL Server
5. MySQL Server
6. Oracle Database Server
7. Sybase Server
0. Abort
Source Database System:

Perfecto, funciona!!!, pero pulsamos 0 para salir. Antes tengo que comentarte unas cosas:

COSAS PREVIAS A HACER

Para que no nos de errores del tipo «Class not Found», copiaremos los ficheros .jar con el driver JDBC en la subcarpeta migration-tool-script/java/lib
P.ej el ORACLE Thin driver que es: «ojdbc14.jar»


$ cp <ruta_driver>/ojdbc14.jar $HOME/Desktop/migration-tool-script/java/lib

El driver JDBC de MySQL no es necesario porque ya va incluido.

Mas cosas:

Esto es MUY IMPORTANTE.
Da igual que el asistente te pida user y password no lo tiene en cuenta, perdi mucho tiempo hasta que me di cuenta de que para que te coja la conexion tienes que pasarselos en la URL.
Por ejemplo para ORACLE la url es de la forma:


jdbc:oracle:thin:<user>/<pass>@<server>:<port>:<sid>
Ejemplo:
jdbc:oracle:thin:demo/demo@repositorio:1521:DESARROLLO

y para MySQL es de la forma:


jdbc:mysql://<server>:<port>/?user=<user>&password=<pass>
Ejemplo:
jdbc:mysql://localhost:3306/?user=jose&password=jose

Tampoco migres directamente de una base de datos a otra, a mi me dio error (es otro bug) lo que si hice es generar los Scripts de Migracion de la base de datos y luego conectarme a la base de datos destino y lanzarlos. la migracion directa no la recomiendo.

Y poco mas, vamos a ver un ejemplo completo, muy completito:


./run_migration_simple

Pego incluso los errores que tuve (cuando no ponia las URLS como he comentado antes):
Es muy largo pero te puede servir de ayuda.
Lo que hace el asistente es ir pidiendote datos, primero la conexion origen,
despues la de destino, que esquemas quieres copiar y si quieres o no
generar scripts de migracion.
En el ejemplo lo puedes ver mejor.
Por cierto, he capado los nombres reales, por **** pero te sirve igual para darte una idea.


root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ls
grtsh lua README.script run_migration~ run_migration_simple~ xml
java ojdbc14.jar run_migration run_migration_simple scripts
root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ./run_migration_simple
MySQL Migration Toolkit - Script Version 1.1.9exp
-------------------------------------------------
Initializing migration environment...
Initialisation complete.
*******************************
* Source database connection. *
*******************************
Please choose a database system:
--------------------------------
1. MS Access
2. Generic Jdbc
3. MaxDB Database Server
4. MS SQL Server
5. MySQL Server
6. Oracle Database Server
7. Sybase Server
0. Abort
Source Database System: 5
Please choose a connection:
---------------------------
1. Create new connection
0. Abort
Connection: 1
Creating new connection to MySQL Server ...
-------------------------------------------
Please enter the connection parameters.
Please choose a driver:
1. MySQL JDBC Driver 5.0
0. Abort
Driver: 1
Hostname: localhost
Port: [3306] 3306
Username: jose
Password: jose
Default Schema: (information_schema, EVO, mysql) EVO
Connection String: jdbc:mysql://localhost/EVO
Connection name (leave blank not to store):
Testing connection to MySQL Server ...
--------------------------------------
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Opening connection ...
Connection jdbc:mysql://localhost/EVO
The connection to the MySQL Server database could not be established.
The following error occured.
"Access denied for user ''@'localhost' (using password: NO)"
"com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
com.mysql.jdbc.Mysq
Choose different connection: (1. Yes, 0. Abort) 1
Please choose a database system:
--------------------------------
1. MS Access
2. Generic Jdbc
3. MaxDB Database Server
4. MS SQL Server
5. MySQL Server
6. Oracle Database Server
7. Sybase Server
0. Abort
Source Database System: 5
Please choose a connection:
---------------------------
1. Create new connection
0. Abort
Connection: 1
Creating new connection to MySQL Server ...
-------------------------------------------
Please enter the connection parameters.
Please choose a driver:
1. MySQL JDBC Driver 5.0
0. Abort
Driver: 1
Hostname: localhost
Port: [3306] 3306
Username: jose
Password: jose
Default Schema: (information_schema, EVO, mysql) EVO
Connection String: jdbc:mysql://localhost:3306/?user=jose&password=jose
Connection name (leave blank not to store):
Testing connection to MySQL Server ...
--------------------------------------
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Opening connection ...
Connection jdbc:mysql://localhost:3306/?user=jose&password=jose
Getting version information ...
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Test completed successfully.
*******************************
* Target database connection. *
*******************************
Please choose a database system:
--------------------------------
1. MySQL Server
0. Abort
Source Database System: 0
root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# clear
root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script# ./run_migration_simple
MySQL Migration Toolkit - Script Version 1.1.9exp
-------------------------------------------------
Initializing migration environment...
Initialisation complete.
*******************************
* Source database connection. *
*******************************
Please choose a database system:
--------------------------------
1. MS Access
2. Generic Jdbc
3. MaxDB Database Server
4. MS SQL Server
5. MySQL Server
6. Oracle Database Server
7. Sybase Server
0. Abort
Source Database System: 6
Please choose a connection:
---------------------------
1. Create new connection
0. Abort
Connection: 1
Creating new connection to Oracle Database Server ...
-----------------------------------------------------
Please enter the connection parameters.
Please choose a driver:
1. Oracle Thin JDBC Driver using SID
2. Oracle Thin JDBC Driver using Service
0. Abort
Driver: 1
SID: DESARROLLO
Hostname: localhost
Port: [1521] 1521
Username: demo
Password: demo
Connection String: jdbc:oracle:thin:demo/demo@localhost:1521:DESARROLLO
Connection name (leave blank not to store):
Testing connection to Oracle Database Server ...
------------------------------------------------
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Opening connection ...
Connection jdbc:oracle:thin:demo/demo@localhost:1521:DESARROLLO
Getting version information ...
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Test completed successfully.
*******************************
* Target database connection. *
*******************************
Please choose a database system:
--------------------------------
1. MySQL Server
0. Abort
Source Database System: 1
Please choose a connection:
---------------------------
1. Create new connection
0. Abort
Connection: 1
Creating new connection to MySQL Server ...
-------------------------------------------
Please enter the connection parameters.
Please choose a driver:
1. MySQL JDBC Driver 5.0
0. Abort
Driver: 1
Hostname: localhost
Port: [3306] 3306
Username: jose
Password: jose
Default Schema: (information_schema, EVO, mysql) EVO
Connection String: jdbc:mysql://localhost/?user=jose&password=jose
Connection name (leave blank not to store):
Testing connection to MySQL Server ...
--------------------------------------
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Opening connection ...
Connection jdbc:mysql://localhost/?user=jose&password=jose
Getting version information ...
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Test completed successfully.
*****************************
* Fetching source schemata. *
*****************************
List of source schemata fetched successfully.
*********************
* Schema selection. *
*********************
Choose the schemata to migrate ...
----------------------------------
1. DBSNMP
2. EVO
3. OUTLN
4. SYS
5. SYSTEM
0. Abort
Schemata: (ids seperate with ,) 2
Selected schema(ta):
--------------------
EVO
Accept selection: (1. Yes, 2. Reselect, 0. Abort) 1
************************
* Reverse engineering. *
************************
Reverse engineering Oracle Database Server ...
----------------------------------------------
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Opening connection ...
Connection jdbc:oracle:thin:demo/demo@localhost:1521:DESARROLLO
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Opening connection ...
Connection jdbc:oracle:thin:demo/demo@localhost:1521:DESARROLLO
Getting version information ...
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Build simple Oracle datatypes.
Call Oracle stored procedure ANALYZE_SCHEMA for EVO.
CALL DBMS_UTILITY.ANALYZE_SCHEMA(?, 'ESTIMATE', 50, 0, 'FOR TABLE')
Fetch the number of tables in the schema EVO.
SELECT COUNT(*) AS TABLECOUNT FROM ALL_TABLES t, ALL_OBJECTS a WHERE t.OWNER=? AND a.OWNER=t.OWNER AND a.OBJECT_NAME=t.TABLE_NAME AND a.OBJECT_TYPE='TABLE' AND a.STATUS='VALID'
Fetching 30 table(s) of the schema EVO.
SELECT t.* FROM ALL_TABLES t, ALL_OBJECTS a WHERE t.OWNER=? AND a.OWNER=t.OWNER AND a.OBJECT_NAME=t.TABLE_NAME AND a.OBJECT_TYPE='TABLE' AND a.STATUS='VALID' ORDER BY t.OWNER, t.TABLE_NAME
Processing table STCORE_*****
...etc... Lista con todas las tablas...
Processing table STCORE_*****
Fetch column information.
Fetching column information.
SELECT tc.TABLE_NAME, tc.COLUMN_NAME, tc.DATA_TYPE, tc.DATA_TYPE_MOD, tc.CHAR_LENGTH, tc.DATA_LENGTH, tc.DATA_PRECISION, tc.DATA_SCALE, tc.NULLABLE, tc.DEFAULT_LENGTH, tc.DENSITY, tc.NUM_NULLS, tc.NUM_BUCKETS, tc.CHARACTER_SET_NAME, tc.DATA_DEFAULT FROM ALL_TAB_COLUMNS tc, ALL_TABLES t WHERE tc.OWNER=? AND t.OWNER=tc.OWNER AND tc.TABLE_NAME=t.TABLE_NAME ORDER BY tc.TABLE_NAME, tc.COLUMN_ID
Fetch PK information.
Fetching primary key information.
SELECT c.TABLE_NAME, i.COLUMN_NAME FROM ALL_CONSTRAINTS c, ALL_TABLES t, ALL_IND_COLUMNS i WHERE c.OWNER=? AND t.OWNER=c.OWNER AND c.TABLE_NAME=t.TABLE_NAME AND c.CONSTRAINT_TYPE='P' AND c.INDEX_NAME=i.INDEX_NAME AND i.TABLE_OWNER=c.OWNER AND i.TABLE_NAME=c.TABLE_NAME ORDER BY c.TABLE_NAME
Fetch index information.
Fetching indices information.
SELECT i.*, ic.COLUMN_NAME, ic.COLUMN_LENGTH, ic.DESCEND FROM ALL_INDEXES i, ALL_IND_COLUMNS ic, ALL_CONSTRAINTS c, ALL_TABLES t WHERE i.TABLE_OWNER=? AND t.OWNER=i.OWNER AND i.TABLE_NAME=t.TABLE_NAME AND ic.TABLE_OWNER=i.TABLE_OWNER AND ic.TABLE_NAME=i.TABLE_NAME AND ic.INDEX_NAME=i.INDEX_NAME AND c.OWNER(+)=i.OWNER AND c.CONSTRAINT_NAME(+)=i.INDEX_NAME AND (c.CONSTRAINT_TYPE is null OR c.CONSTRAINT_TYPE<>'P') ORDER BY i.TABLE_NAME, ic.INDEX_NAME, ic.COLUMN_POSITION
Fetch FK information.
Fetching FK information.
SELECT c.TABLE_NAME, c.CONSTRAINT_NAME, c."DEFERRABLE", c.DELETE_RULE, cc.COLUMN_NAME, r.OWNER AS R_SCHEMA, r.TABLE_NAME AS R_TABLE, rc.COLUMN_NAME AS R_COLUMN FROM ALL_CONSTRAINTS c, ALL_CONS_COLUMNS cc, ALL_CONSTRAINTS r, ALL_CONS_COLUMNS rc WHERE c.OWNER=? AND c.CONSTRAINT_TYPE = 'R' AND c.R_OWNER=r.OWNER AND c.R_CONSTRAINT_NAME=r.CONSTRAINT_NAME AND c.CONSTRAINT_NAME = cc.CONSTRAINT_NAME AND c.OWNER = cc.OWNER AND r.CONSTRAINT_NAME = rc.CONSTRAINT_NAME AND r.OWNER = rc.OWNER AND cc.POSITION = rc.POSITION ORDER BY c.TABLE_NAME, c.CONSTRAINT_NAME, cc.POSITION
Fetch trigger information.
Fetching FK information.
SELECT t.TABLE_NAME, t.TRIGGER_NAME, t.TRIGGER_TYPE, t.TRIGGERING_EVENT, t.BASE_OBJECT_TYPE, t.COLUMN_NAME, t.REFERENCING_NAMES, t.WHEN_CLAUSE, t.STATUS, t.DESCRIPTION, t.ACTION_TYPE, t.TRIGGER_BODY FROM ALL_TRIGGERS t, ALL_TABLES ta WHERE t.TABLE_OWNER=? AND ta.OWNER=t.OWNER AND t.TABLE_NAME=ta.TABLE_NAME ORDER BY t.TABLE_NAME
Fetch all views of the schema EVO.
SELECT v.*, c.STATUS as CHECK_ENABLED FROM ALL_VIEWS v, ALL_CONSTRAINTS c, ALL_OBJECTS a WHERE v.OWNER=? AND c.TABLE_NAME(+)=v.VIEW_NAME AND c.CONSTRAINT_TYPE(+)='V' AND a.OWNER=v.OWNER AND a.OBJECT_NAME=v.VIEW_NAME AND a.OBJECT_TYPE='VIEW' AND a.STATUS='VALID' ORDER BY v.OWNER, v.VIEW_NAME
Processing view *****
..Lista con las vistas...
Fetching column information.
SELECT tc.TABLE_NAME, tc.COLUMN_NAME FROM ALL_TAB_COLUMNS tc, ALL_VIEWS v WHERE tc.OWNER=? AND v.OWNER=tc.OWNER AND tc.TABLE_NAME=v.VIEW_NAME ORDER BY tc.TABLE_NAME, tc.COLUMN_ID
ERROR: Index: 4, Size: 4
Views fetched.
Fetch count of stored procedures of the schema EVO.
SELECT COUNT(*) AS NUM FROM ALL_PROCEDURES p, ALL_OBJECTS a WHERE p.OWNER=? AND a.OWNER=p.OWNER AND a.OBJECT_NAME=p.OBJECT_NAME AND (a.OBJECT_TYPE='PROCEDURE' OR a.OBJECT_TYPE='FUNCTION') AND a.STATUS='VALID' ORDER BY p.OBJECT_NAME
Fetching 0 stored procedure(s) of the schema EVO.
SELECT p.*, (SELECT max(s.TYPE) FROM ALL_SOURCE s WHERE s.OWNER=? AND s.NAME=p.OBJECT_NAME) as TYPE FROM ALL_PROCEDURES p, ALL_OBJECTS a WHERE p.OWNER=? AND a.OWNER=p.OWNER AND a.OBJECT_NAME=p.OBJECT_NAME AND (a.OBJECT_TYPE='PROCEDURE' OR a.OBJECT_TYPE='FUNCTION') AND a.STATUS='VALID' ORDER BY p.OBJECT_NAME
SELECT TEXT FROM ALL_SOURCE WHERE OWNER=? AND NAME=? ORDER BY LINE
Stored procedures fetched.
Fetch the number sequences of the schema EVO.
SELECT COUNT(*) AS NUM FROM ALL_SEQUENCES s, ALL_OBJECTS a WHERE s.SEQUENCE_OWNER=? AND a.OWNER=s.SEQUENCE_OWNER AND a.OBJECT_NAME=s.SEQUENCE_NAME AND a.OBJECT_TYPE='SEQUENCE' AND a.STATUS='VALID'
Fetch 4 sequence(s) of the schema EVO.
SELECT s.SEQUENCE_NAME, s.MIN_VALUE, s.MAX_VALUE, s.INCREMENT_BY, s.CYCLE_FLAG, s.ORDER_FLAG, s.CACHE_SIZE, s.LAST_NUMBER FROM ALL_SEQUENCES s, ALL_OBJECTS a WHERE s.SEQUENCE_OWNER=? AND a.OWNER=s.SEQUENCE_OWNER AND a.OBJECT_NAME=s.SEQUENCE_NAME AND a.OBJECT_TYPE='SEQUENCE' AND a.STATUS='VALID' ORDER BY s.SEQUENCE_NAME
Sequences fetched.
Reverse engineering completed successfully.
**************************
* Get migration methods. *
**************************
Fetching available migration methods ...
----------------------------------------
**********************
* Setup ignore list. *
**********************
Your current ignore list:
-------------------------
Oracle Table
None
Oracle View
None
Oracle Sequence
None
1. Accept ignore list
2. Add item to ignore list
3. Delete item from ignore list
0. Abort
Selection: 1
*************************
* Performing migration. *
*************************
Starting Oracle migration...
Migrating schema EVO ...
Migrating tables ...
Migrating table *****
Migrating views ...
Migrating view *****
Migrating routines ...
Migration completed.
Migration completed successfully.
***************************
* Generate target objects *
***************************
Create object online or write a SQL create script? (1. online, 2. script, 3. both, 0. abort) 1
Create database objects.
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Opening connection ...
Connection jdbc:mysql://localhost/?user=jose&password=jose
The SQL create script cannot be executed.
"The function TransformationMysql:splitSqlCommands() returned the following error:
You have to submit a SQL script string as parameter."
"com.mysql.grt.Grt.callGrtFunction(Unknown Source)
com.mysql.grt.modules.TransformationMysqlJdbc.executeSqlStatements(Unknown Source)
com.mysql.grt.modules.TransformationMysqlJdbc.executeSqlStatementroot@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script#
==================
La migracion online (opcion 1) tiene un bug y nos da un error, entonces nos salimos y volvemos a intentarlo comenzando desde el
principio hasta este punto...
---------------------------
1. Create new connection
0. Abort
Connection: 1
Creating new connection to MySQL Server ...
-------------------------------------------
Please enter the connection parameters.
Please choose a driver:
1. MySQL JDBC Driver 5.0
0. Abort
Driver: 1
Hostname: localhost
Port: [3306] 3306
Username: jose
Password: jose
Default Schema: (information_schema, EVO, mysql) EVO
Connection String: jdbc:mysql://localhost/?user=jose&password=jose
Connection name (leave blank not to store):
Testing connection to MySQL Server ...
--------------------------------------
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Opening connection ...
Connection jdbc:mysql://localhost/?user=jose&password=jose
Getting version information ...
Initializing JDBC driver ...
Driver class MySQL JDBC Driver 5.0
Test completed successfully.
*****************************
* Fetching source schemata. *
*****************************
List of source schemata fetched successfully.
*********************
* Schema selection. *
*********************
Choose the schemata to migrate ...
----------------------------------
1. DBSNMP
2. EVO
3. OUTLN
4. SYS
5. SYSTEM
0. Abort
Schemata: (ids seperate with ,) 2
Selected schema(ta):
--------------------
EVO
Accept selection: (1. Yes, 2. Reselect, 0. Abort) 1
************************
* Reverse engineering. *
************************
Reverse engineering Oracle Database Server ...
----------------------------------------------
...Lo de ANTES (omito el texto)....
Reverse engineering completed successfully.
**************************
* Get migration methods. *
**************************
Fetching available migration methods ...
----------------------------------------
**********************
* Setup ignore list. *
**********************
Your current ignore list:
-------------------------
Oracle Table
None
Oracle View
None
Oracle Sequence
None
1. Accept ignore list
2. Add item to ignore list
3. Delete item from ignore list
0. Abort
Selection: 1
*************************
* Performing migration. *
*************************
Starting Oracle migration...
Migration completed.
Migration completed successfully.
***************************
* Generate target objects *
***************************
Create object online or write a SQL create script? (1. online, 2. script, 3. both, 0. abort) 2
Write create script.
**********************
* Bulk data transfer *
**********************
Write a SQL insert script? (1. yes, 2. no, 0. abort) 1
Execute bulk data transfer
--------------------------
Opening output script file ...
Initializing source JDBC driver ...
Initializing JDBC driver ...
Driver class Oracle Thin JDBC Driver using SID
Opening connection ...
Connection ****
Processing schema EVO ...
Getting the number of rows of table ****
SELECT count(*) AS total_num FROM "EVO"."****"
Transfering data from table STCORE_CONFIGFILE (2/2 rows)
Data bulk transfer finished.
Migration finished.
-------------------
root@soledad:~/Desktop/mysql-gui-tools-5.0/migration-tool-script#

Y al final de la ejecucion tenemos los scripts creados «inserts.sql» y «creates.sql», creates.sql contiene las sentencias DDL de creacion de las tablas y vistas, e inserts contiene las sentencias SQL de insercion de datos.

Para ejecutar estos Scripts empleas el cliente de MySQL.

O tal y como comentan aqui,

puedes lanzarlos desde la consola con:


$ mysql base_datos < creates.sql
$ mysql base_datos < inserts.sql

Sustituyendo base_datos por la que corresponda. Ya esta!!!
Ya tienes tu base de datos de Oracle en MySQL. A disfrutarla…

10 Respuestas to “Migrar de Oracle a MySQL empleando MySQL Migration Toolkit”


  1. 1 engerix abril 20, 2007 a las 6:18 pm

    Que buen post!!! Una sola palabra:
    Espectacular.
    Gracias

  2. 2 superpiwi abril 20, 2007 a las 7:05 pm

    Muchas thx, a mi me ha venido de fabula porque en el trabajo uso Oracle, pero en casa me gusta trastear con MySQL. Como migre todo, al final me voy a pedir el teletrabajo 😉

  3. 3 elexander May 30, 2008 a las 5:34 pm

    oye gran ayudas has brindado, soy iniciante de esta aplicacion en ambiente linux-Debian

  4. 4 rafa octubre 12, 2008 a las 2:52 am

    no he podido instalar el migration la instruccion me marca unkown option

  5. 5 julian noviembre 5, 2008 a las 3:25 pm

    Hola, he tenido un problema y es que quiero migrar de access a mysql pero me da un error con el driver odbc de access, ya descargue uno he hice lo misco que lo que se mostro con oracle y nada. si pueden ayudarme se le agradecera enormemente, o sino volver a windows

  6. 6 Manu007 noviembre 26, 2008 a las 3:49 pm

    Gracias por este «joutu», me acabas de librar de un buen dolor de cabeza…

  7. 7 mayte abril 2, 2018 a las 1:55 am

    Hola, la herramienta que utilizas es solo para Linux verdad? yo quisiera hacerlo en Windows, utilizas lo mismo?

  8. 8 Elise marzo 31, 2019 a las 6:02 pm

    Apprecxiation to my father who shared wigh me about this website, this webpage is
    in fact amazing.


  1. 1 Migrar de Oracle a MySQL empleando MySQL Migration Toolkit « Java.Lang.NullPointer Trackback en abril 20, 2007 a las 10:00 am
  2. 2 clublasala.net » Nó sálen los caracteres españoles Trackback en julio 16, 2008 a las 11:50 pm

Deja un comentario







¿Es compatible tu equipo con Ubuntu?


( Muchos fondos de pantalla, aqui )

DESCARGATE SCIFI LIFE

365 Dias de Soledad
Me debes los sueños, las promesas y las noches rotas. Me debes la paz, la sonrisa y la esperanza robadas. Me debes la sangre, las lágrimas y el sudor vertido. Me debes las noches vacías, los abrazos anhelados. Me debes un beso de ajenjo de tu amarga boca.

The Ubuntu Counter Project - user number # 11961
Geo Visitors Map

Archivos

abril 2007
L M X J V S D
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Blog Stats

  • 31.400.909 hits