Migrate oracle to mysql
JavaScript
Latest commit 710e4cb May 13, 2013 @iamdenny Update Migrator.js
license updated
Failed to load latest commit information.
lib Update Migrator.js May 13, 2013
.gitignore first commit Dec 17, 2012
README.md Update README.md May 13, 2013
index.js debuging Dec 17, 2012
package.json oracle connectin error fixed Dec 21, 2012

README.md

Migrate-Oracle-To-Mysql

Mirate oracle to mysql.

How to Install

NPM

npm install migrate-oracle-to-mysql

GIT

git clone https://github.com/iamdenny/migrate-oracle-to-mysql.git

ENV

  • It's really important. You should set up these variables
  • '/opt/instantclient' is the installed directory of Oracle Client
export OCI_INCLUDE_DIR=/opt/instantclient/sdk/include
export OCI_LIB_DIR=/opt/instantclient
export LD_LIBRARY_PATH=/opt/instantclient
export NLS_LANG=American_America.AL32UTF8

How to use

Make tables schema on Mysql same as tables schema on Oracle first.

app.js

var Mom = require('migrate-oracle-to-mysql');
var htOracle = {
    sHostname : '127.0.0.1',
    sUser : 'username',
    sPassword : 'password',
    nPort : 1527,
    sDatabase : 'database or sid'
};
var htMysql = {
    sHostname : '127.0.0.1',
    sUser : 'username',
    sPassword : 'password',
    nPort : 3306,
    sDatabase : 'database',
    bDebug : false
};
var oMom = new Mom(htOracle, htMysql);

oMom.on('connected', function(){
    // first arg : oracle query
    // second arg : mysql table name
    // third arg : truncate(delete data from mysql table)
    // forth arg : callback
    oMom.migrateByQuery("SELECT username, nickname FROM user",
      'user', true, function(htResult){
          console.log('First migration is done', htResult);
      });

    oMom.migrateByQuery("SELECT group_id, group_name FROM group",
      'group', true, function(htResult){
          console.log('Second migration is done', htResult);
      });

    oMom.migrateByQuery("SELECT article_idx, title FROM article",
      'article', true, function(htResult){
          console.log('Thrid migration is done', htResult);
      });      
}).on('done', function(htResult){
    console.log('All done', htResult);
    process.exit(0);
});

Execute

node app.js

License

MIT License

Copyright 2013 NHN Corp.