4. Migration Process (analyze)
Source Database襯 覿 覓伎 伎 蟾?
1. 危危蠍 企れ 蠍磯ル 蠍磯リ讌 襴ろ碁ゼ 襷れ.
Issue Workaround Grade* Notes
Reference to external schemas in the
a different instance (db link)
10
螻牛讌
るジ 襭朱 覲蟆
Packages See Writing stored procedures 9 豌 貊
Procedures See Writing stored procedures 9 豌 貊
Unique key longer then 255 charac
ters
See Key length limitations 4
Views alias Manually added 4 覲豺 朱 豢螳
Sequences See Migration of Sequences 3
螳ロ覃 Auto Increment襦
覲
Empty schemas See empty schema definitions 2 襦 覲
2. Source Data 誤. ( 一危 企, 覿 or 讌螻 一危, etc)
3. ろる覲 碁 覲旧′煙 蟆.
4. Database Object襯 蠍 碁(觜) 碁 螳
5. Database or Application 蠍磯レ 蠍 碁(觜) 碁 螳
5. Migration Process (understand)
Oracle螻 MySQL 谿伎 危危.
Server
Oracle Schema object 覓語 蟲覲
MySQL lower_case_table_names 旧 磯 覓語 蟲覲
Oracle 企 default螳朱 not null 覈
MySQL Millisecond 5.6覿 讌
Oracle Data Type 覲讌
MySQL sql_mode襦 讌
Oracle varchar2 4,000Byte
MySQL varchar 65,535Byte
Oracle System Privileges local/external : roles
MySQL Privileges (local : no roles)
MySQL Oracle dummy table(dual) 螻牛讌
select 1+1 from dual (oracle)
select 1+1 (MySQL)
6. Migration Process (understand)
Oracle螻 MySQL 谿伎 危危.
DML & DDL
Key length limitations
Oracle index 觚襦伎 40%蟾讌 碁煙れ襴 螳 MySQL 覓語
MySQL 蟆曙 primary key index 蟆曙 255蟾讌 螳(utf-8 蟆曙)
index_large_prefix 旧朱 row format compressed 螳
Oracle Sequence Autoincremet襦 豌
Autoincrement Not null伎伎 覃, Primary key襦 燕伎
Oracle sequence 螳 蟆
ex) SELECT MAX(id)+1 FROM tab
MySQL 蟆曙 LAST_INSERT_ID()朱
7. Schema Migration
Oracle MySQL
Package N/A
Primary key Primary key
Role N/A
Schema Schema
Sequence AUTO_INCREMENT
Snapshot N/A
Synonym N/A
Table Table
Tablespace N/A
Temporary Table Temporary Table
Trigger for each row Trigger for each row
Unique key Unique Key
View View
Schema Object Similarities
8. Data Types
Data Type Mapping
MySQL Oracle
BIGINT NUMBER(19,0)
BIT RAW
BLOB BLOB, RAW
CHAR CHAR
DATE DATE
DATETIME DATE
DECIMAL FLOAT(24)
DOUBLE FLOAT(24)
DOUBLE PRECISION FLOAT(24)
ENUM VARCHAR2
FLOAT FLOAT
INT NUMBER(10,0)
INTEGER NUMBER(10,0)
LONGTEXT BLOB, RAW
9. Data Types
Data Type Mapping
MySQL Oracle
MEDIUMBLOB BLOB, RAW
MEDIUMINT NUMBER(7,0)
MEDIUMTEXT CLOB, RAW
NUMERIC NUMBER
REAL FLOAT(24)
SET VARCHAR2
SMALLINT NUMBER(5,0)
TEXT VARCHAR2, CLOB
TIME DATE
TIMESTAMP DATE
TINYBLOB RAW
TINYINT NUMBER(3,0)
TINYTEXT VARCHAR2
VARCHAR VARCHAR2, CLOB
YEAR NUMBER
10. Data Types
Data Type 觜蟲 Numeric Types
MySQL Size Oracle
BIGINT 8 Bytes NUMBER(19,0)
BIT (M+7)/8 Bytes RAW
DECIMAL(M,D)
D>0覃 M+2 bytes D=0企 M+1 bytes
M<D覃 D+2 bytes
FLOAT(24), BINARY_FLOAT
DOUBLE 8 Bytes
FLOAT(24), BINARY_FLOAT,
BINARY_DOUBLE
DLUBLE PRECION 8 Bytes FLOAT(24), BINARY_DOUBLE
FLOAT(25<=X<53) 8 Bytes FLOAT(24), BINARY_FLOAT
FLOAT(x<=24) 4 Bytes FLOAT, BINARY_FLOAT
INT 4 Bytes NUMBER(10,0)
INTEGER 4 Bytes NUMBER(10,0)
MEDIUMINT 3 Bytes NUMBER(7,0)
NUMERIC
D>0覃 M+2 bytes D=0企 M+1 bytes
M<D覃 D+2 bytes
NUMBER
REAL 8 Bytes FLOAT(24), BINARY_FLOAT
SMALLINT 2 Bytes NUMBER(5,0_
TINYINT 1 Bytes NUMBER(3,0)
11. Data Types
Data Type 觜蟲 Date and Time Type
MySQL Size Oracle
DATE 3 Bytes DATE
DATETIME 8 Bytes DATE
TIMESTAMP 4 Bytes DATE
TIME 3 Bytes DATE
YEAR 1 Bytes NUMBER
12. Data Types
Data Type 觜蟲 String Types
MySQL Size Oracle
BLOB L + 2 Bytes ~ L<2^16 RAW, BLOB
CHAR(M) M Bytes 0<=M<=255 CHAR
ENUM(V1, V2, ..)
1 OR 2 Bytes
ENUM 螳(豕 65535)
VARCHAR2
LOGBLOB L + 4 Bytes ~ L < 2 ^ 32 RAW, BLOB
LONGTEXT L + 4 Bytes ~ L < 2 ^ 32 RAW, CLOB
MEDIUMBLOB L + 3 Bytes ~ L < 2 ^ 24 RAW, BLOB
MEDIUMTEXT L + 3 Bytes ~ L < 2 ^ 24 RAW, CLOB
SET(V1, V2, ..) 1, 2, 3, 4 or 8 Bytes VARCHAR2
TEXT L + 2 Bytes ~ L < 2 ^ 16 VARCHAR, CLOB
TINYBLOB L + 1 Bytes ~ L < 2 ^ 8 RAW, BLOB
TINYTEXT L + 1 Bytes ~ L < 2 ^ 8 VARCHAR2
VARCHAR(M)
L + 1 Bytes ~ L < M
MySQL 5.0.3 伎 0<=M<=255
MySQL 5.0.3危 0<=M<=65,535
螻殊 MAX SIZE = 65,532
VARCHAR2, CLOB
13. Trigger & SP
Trigger
Trigger & SP
MySQL 企 碁Μ蟇 企企 碁Μ蟇 企欧碁ゼ 螳
襯 る Before insert After updat襯 螳
Oracle 蟆曙 覃 碁Μ蟇磯ゼ ( 碁Μ蟇磯 蟲覓 碁Μ蟇 螳)
MySQL 企 碁Μ蟇 ろ 譴 る 豌襴 覲伎
碁Μ蟇 企企 碁Μ蟇 企欧 譴 襷 ろ蟇磯 ろ 讌 蟆曙 襦る葦
Oracle 碁Μ蟇一 ろ 覈語 碁企 覈 蟆郁骸螳 炎概伎朱 ろ 覃 蠏碁讌
朱 襦る葦
Oracle螻 MySQL Procedure 蟲覓語 谿企 れ螻 螳
Replace蟲覓
DO 蟲覓 MySQL DO蟲覓語 覓願 覦讌 , Oracle 蟆曙 select expr1, into
from dual 蟲覓語朱 覲
覲牛 De
14. Trigger & SP
Stored Procedure
Stored procedure
Oracle螻 MySQL Procedure 蟲覓語 谿
Replace蟲覓
DO 蟲覓
MySQL DO蟲覓語 覓願 覦讌
- Oracle 蟆曙 select expr1, into from dual 蟲覓語朱 覲
覲牛 declare 蟲覓
覲牛 Set 蟲覓
- MySQL
DECLARE a INT; /* simple */
DECLARE a, b INT DEFAULT 5; /* complex */
- Oracle
a INT; /* simple */
a INT := 5;
b INT := 5; /* complex */
- MySQL
SET x:=1; /* simple */
SET x:=1, y:=0; /* complex */
- Oracle
x :=1; /* simple */
x :=1;
y :=0; /* complex */
15. Trigger & SP
Stored Procedure
Package
- MySQL
CREATE PROCEDURE p2() BEGIN
SET @a = 5; SET @b = 5;
SELECT @a, @b;
END;
- Oracle
CREATE OR REPLACE PACKAGE root.globalPkg AS
a NUMBER;
b NUMBER;
END globalPkg;
CREATE OR REPLACE PROCEDURE root.p2 AS
BEGIN
globalPkg.a := 5;
globalPkg.b := 5;
DBMS_OUTPUT.PUT_LINE(globalPkg.a || , ||
globalPkg.b); END p2;