Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

CUBRID Migration Toolkit Concepts


2 Concepts

2.1 CMT

CMT is the abbreviation of CUBRID Migration Toolkit.

CMT includes two parts, one is an application with GUI and another is a console tool.

2.1.1 CMT GUI

CMT GUI can provide some graphic user interfaces to help users finish their migration work.

 

2.1.2 CMT Console Tool

CMT Console Tool tool can run in linux and windows with command line.

Because of no GUI, it has better performace then CMT GUI.

It helps users finish migration work in some OS without GUI.


2-1-2.png

2.2 CUBRID UnloadDB File

Text files that can be loaded into offline CUBRID database by CUBRID loaddb command.

2.3 Migration Script

Migration script is a very important concept in CMT.

Migration scripts are written with XML format. A migration script lets the CMT know how to connect source/target databases and how to transform source DB objects to target DB objects during a migration process.

Migration scripts are created by migration wizard.

2.4 Migration Script Explorer

Migration script explorer is a view which is on the left part by default when CMT GUI is started.

All migration scripts will be listed in this explorer, users can edit the scripts by this explorer.


2-4.png

All that users can do with scripts are as follows:

Open with wizard: Open a migration wizard, the settings in the wizard is according to the selected migration script.

Rename: Rename the selected migration script.

Delete: Delete selected migration script.

Copy: Make a copy of current selected migration script.

Import: Import an external migration script file to list.

Export: Save selected migration script to an external XML file.

ScheduleOpen schedule dialog.

Cancel ScheduleCancel the migration schedule settings of selected migration script.

2.5 Migration Wizard

Migration wizard is a GUI wizard to help users build a migration script step by step.

The first setp is selection migration type and all pages followed will be decided by the selections in the first step.


At the last step of a migration wizard, a migration script will be created or updated and a migration process will start after clicking the Start button.

Users can monitor the migration’s progress when migration is running and view the migration report after migration is finished.

  

2.6 Migration Progress Monitor

If migration is started, users can monitor the migration progress by migration progress monitor.

Users can read how many records were exported and imported, what error was thrown and how much time was cost from migration progress monitor.

Users can also stop the migration process by clicking Stop button, and when the migration is finished the View Report button will be enabled and users can open the report view by clicking this button.


2-7-1.png

2.7 Migration Report

When migration was finished or interrupted, migration engine will generate a migration report and save it into a local file. Users can review the report by Migration History Manager.

The report includes a lot of information about this migration such as which table was created successfully/failed, how many records were exported and how many records were imported and the error logs during migration process.

Different data source may have different report UI.

Migration report

If the migration target is local files, an output directory will be displayed in the migration report.

And the directory will be opened by clicking the text.

SQL importing report

CSV importing report

2.8 Migration Task Reservation

If users want start a migration process at a specific time, not now, migration task schedule can do this.

Users can make the migration process start at a specific time or at a specific time every day or at a specific time with UNIX Cron pattern.

Or at the last step of migration wizard, when users click the “Start” button, a dialog will be popped: 

Users also can choose button “Schedule” to add current migration task to schedule.

2.9 Migration History Manager

Every migration work generated a migration report and the report was saved at local.

Migration History manager lists the old migration reports and allows users to review the reports.

Users can delete the migration histories.

And users can import an external migration report file into history list and open it.

This is often used for checking a migration report generated by CMT console tool.

1.          The table view can provide more information about the migration histories.

2.          The column “Migration name” is the migration script name when the migration started.

3.          The column “Status”:

 *  “Accomplished”: there is no error in the migration;

 *  “Not Accomplished”: there are errors found in the migration;

 *  “Canceled”: the migration started failed.

4.           “Migration name filter” can help users to find the migration histories by migration name. It supports “*” as a wildcard to take place of any character or any words.

 5.          The table viewer can re-sort the items by clicking the column “Migration name” and the column “Start time”..



2.10 Data Type Mapping

Different databases have different data type definitions, so if we want do migration work between different database systems, we should build a data type mapping to let the CMT know how to transform the schemas and data from source database to target database. For example: The string definition is “varhcar2” in Oracle but “varchar” in CUBRID, so we should build a mapping between “varchar2” and “varchar”.

CMT provides a default data type mapping in the preference:

MySQL to CUBRID data type mapping

MySQL Type Name

Return value of JDBC

CUBRID Type

BIT(1) (new in MySQL-5.0)

BIT

Smallint

BIT( > 1) (new in MySQL-5.0)

BIT

Bit(n)

TINYINT

TINYINT

Smallint

BOOL, BOOLEAN

TINYINT

Smallint

SMALLINT<(M)>

<UNSIGNED>

SMALLINT 

<UNSIGNED>

Smallint

Integer

MEDIUMINT<(M)>

<UNSIGNED>

MEDIUMINT 

<UNSIGNED>

Integer

INT,INTEGER<(M)> 

<UNSIGNED>

INTEGER 

<UNSIGNED>

Integer

Bigint

BIGINT<(M)> 

<UNSIGNED>

BIGINT 

<UNSIGNED>

Bigint

Numeric(20)

FLOAT<(M,D)>

FLOAT

FLOAT

DOUBLE<(M,B)>

DOUBLE

DOUBLE

DECIMAL<(M<,D>)>

DECIMAL

DOUBLE

DATE

DATE

DATE

DATETIME

DATETIME

DATETIME

TIMESTAMP<(M)>

TIMESTAMP

TIMESTAMP

TIME

TIME

TIME

YEAR<(2|4)>

YEAR

Char(4)

CHAR(M)

CHAR

Char(n)

VARCHAR(M) <BINARY>

VARCHAR

Varchar(n)

BINARY(M)

BINARY

Bit Varying(n)

VARBINARY(M)

VARBINARY

Bit Varying(n)

TINYBLOB

TINYBLOB

Bit Varying(255)

Blob

TINYTEXT

VARCHAR

Varchar(255)

BLOB

BLOB

Bit Varying(65535)

TEXT

VARCHAR

Varchar(65535)

Clob

MEDIUMBLOB

MEDIUMBLOB

Bit Varying(16277215)

Blob

MEDIUMTEXT

VARCHAR

Varchar(16277215)

Clob

LONGBLOB

LONGBLOB

Bit Varying(1073741823)

Blob

LONGTEXT

VARCHAR

Varchar(1073741823)

Clob

ENUM('value1','value2',...)

CHAR

Varchar(255)

SET('value1','value2',...)

CHAR

SET( Varchar(255) )

Boolean Type

CUBRID does not have a Boolean type. Statements containing Boolean values are transformed by CMT to replace the value with conditional expressions. CMT emulates stored Boolean data by using the CUBRID smallint type.

Character Data Types

CMT converts the basic character types VARCHAR2 and CHAR to CUBRID varchar and char, correspondingly preserving their length. If it is MySQL longtext which has a constant size greater than 1,073,741,823, CMT maps to varchar(1073741823).

If target CUBRID database is specified to access by “UTF-8” charset, varchar or char size would be specified size multi 3. For example, if source MySQL data type is char(255), then the target CUBRID data type is char(765). If target CUBRID database is specified to access by “Unicode” charset or other not “UTF-8” charset, varchar or char size would be specified size multi 2.

Date and Time

CUBRID does not has year data type, so CMT maps year(2|4) to char(4).

 

Oracle to CUBRID data type mapping

Oracle Type Name

Return value of JDBC

CUBRID Type

Bfile

InputSteam

Blob

Binary_double

Double

Double

Binary_float

Float

Float

Blob

Blob

Blob

Char(n)

String

Character(n)

Decimal(p,s)

BigDecimal

Numeric(p,s)

Float

Float

Float

Interval day to second

String

Character varying(255)

Interval year to month

String

Character varying(255)

Long

String

Clob

Long raw

Byte[]

Bit varying(1073741823)

Blob

NChar(n)

String

Character(n)

Nclob

Clob

Character varying(1073741823)

Number(p,s)

getBigDecimal

Numeric(p,s)

Number(,0)

getBigDecimal

Numeric(38,0)

Number

getBigDecimal

Numeric(38,0)

Nvarchar2(n)

String

Character varying(n)

Raw(n)

Byte[]

Bit Varying(n)

Rowid

Rowid

Character varying(64)

Timestamp

Timestamp

Timestamp

Timestamp with local time zone

Timestamp

Timestamp

Timestamp with time zone

Timestamp

Timestamp

Urowid

Rowid

Character varying(64)

Varchar2(n)

String

Character varying(n)

 

Character Data Types

CMT converts the basic character types VARCHAR2 and CHAR to CUBRID varchar and char, correspondingly preserving their length. If it is Oracle Long type which has a constant size greater than 1,073,741,823, CMT maps to varchar(1073741823).

If target CUBRID database is specified to access by “UTF-8” charset, varchar or char size would be specified size multi 3. For example, if source Oracle data type is char(255), then the target CUBRID data type is char(765). If target CUBRID database is specified to access by “Unicode” charset or other not “UTF-8” charset, varchar or char size would be specified size multi 2.

Date and Time

CUBRID doesn’t have "Timestamp with local time zone" and "Timestamp with time zone" types, so time zone information may be lost.

CUBRID doesn’t have "Interval day to second" and "Interval year to month", so map them to "Character varying(255)"

 

CUBRID to CUBRID data type mapping

CUBRID Type Name

Return value of JDBC

CUBRID Type

Bigint

BIGINT

Bigint

Bit(n)

BINARY

Bit(n)

Bit varying(n)

VARBINARY

Bit varying(n)

blob

VARBINARY

Blob

Character(n)

CHAR

Character(n)

Character varying(n)

VARCHAR

Character varying(n)

clob

VARCHAR

Clob

Date

DATE

Date

Datetime

TIMESTAMP

Datetime

Double

DOUBLE

Double

Float

REAL

Float

Glo

Object

Glo

Integer

INTEGER

Integer

Monetary

DECIMAL

Monetary

Set_of(data type)

ARRAY

Set_of(data type)

Multiset_of(data type)

ARRAY

Multiset_of(data type)

Sequence_of(data type)

ARRAY

Sequence_of(data type)

National character(n)

CHAR

National character(n)

National character varying(n)

VARCHAR

National character varying(n)

Numeric(p,s)

NUMERIC

Numeric(p,s)

Smallint

SMALLINT

Smallint

Time

TIME

Time

Timestamp

TIMESTAMP

Timestamp   

 

2.11 User defined data handler

In the column mapping view of the object mapping step, users can define a data handler which is responsible for transform the data read from source to the data which will be written into target. And if this data handler is specified, the CMT will not do any transforming work about the column data during the migration.

This setting includes two parts: the jar file name and the full class name of the handler in the jar file.

The jar file should be in the “handlers” directory of the migration application’s working directory, for example:

The handler class must implement a method “public Object convert(Map<String,Object> recordMap,String columnName)”, for example:

package  com.cubrid.migration;

 

public  class  TestConvert {

 

    public  Object convert(Map<String,Object> recordMap,String columnName) {

        return  "Test for data handler:" + recordMap.get(columnName);

    }

}

Parameter “recordMap” stores the record’s column and data information: the key of the map is source table’s column name and the value of the map is the column’s data.

Parameter “columnName” is the current source table’s column name to be handled.

Return value should be the data which will be inserted into target.

During the migration, the method “convert” will be called to convert the data from source to the data which will be written into target.

And all dependences of the handler class should be packaged into the jar file to ensure the handler can work well.

2.12 Bug reporter

Users can report bugs during using CMT if users have connected with internet.


2-13-1.png

 

 

2.13 Notice Dashboard

 

Users can get some news about CUBRID and CUBRID Tools from this view.

2-15-1.png

 

 

Go back

comments powered by Disqus
Page info
viewed 2015 times
translations en
Author
posted last year by
kevinlin79
Contributors
updated 3 months ago by
View revisions
tagged
Share this article