原作者 .
- 迁移工具
对象兼容性评估采用MTK工具完成,MTK工具是云和恩墨自研的跨平台异构数据库迁移工具,可执行异构数据库的对象结构迁移,并能实现自定义函数,存储过程,触发器等部分业务逻辑的自动改写适配。软件下载地址:https://docs.mogdb.io/zh/mtk/v2.0/release-notes
1.1 工具部署说明
DB2和Oracle需要具备数据库客户端(MySQL不需要);
由于DB2不支持ARM环境客户端,因此目标端为ARM环境情况下需要将MTK工具部署在源端或非ARM环境中间服务器;
DB2迁移至MogDB:除目标端是ARM环境外,可以选择部署在源端或目标端;
MySQL/Oracle迁移至MogDB:MTK工具可以选择部署在源端或目标端。
1.2 mtk工具部署
mkdir -p /dbdata/app/mtk
tar -zxvf mtk_2.3.2_linux_amd64.tar.gz
chown -R omm: /dbdata/app/mtk
1.3 申请license
./mtk license gen
1.4 查看mtk工具版本号
./mtk -v
2. 设置配置文件
关于MTK配置说明可以参考:https://docs.mogdb.io/zh/mtk/v2.0/mtk-config
cd /dbdata/app/mtk/mtk_0.0.38_linux_amd64
{
“source”: {
“type”: “oracle”,
“connect”: {
“version”: “”,
“host”: “192.168.80.11”,
“user”: “mogdb”,
“port”: 1521,
“password”: “mogdb@123”,
“dbName”: “orcl”,
“dsn”: “”
}
},
“target”: {
“type”: “MogDB”,
“connect”: {
“version”: “2.0.1”,
“host”: “192.168.80.12”,
“user”: “mogdb”,
“port”: 26000,
“password”: “mogdb@1234”,
“dbName”: “myorcl”,
“dsn”: “”
},
“parameter”: {
“dropExistingObject”: false,
“truncTable”: false,
“path”: “./data/oracle”,
“fileType”: “sql”,
“fileSize”: “500MiB”,
“csvHeader”: true,
“csvFieldDelimiter”: “|”,
“csvOptionallyEnclosed”: “’”,
“parallelInsert”: 1,
“timeFormat”: “HH:MI:SS”,
“dateFormat”: “YYYY-MM-DD”,
“dateTimeFormat”: “YYYY-MM-DD HH24:MI:SS”,
“noSupportPartTabToNormalTab”: false,
“virtualColToNormalCol”: false,
“mySQLToOgCharExpression”: “* 3”,
“mySQLSkipErrorDateTimeData”: false,
“ignoreTableDDLCompErr”: true,
“colKeyWords”: {},
“objKeyWords”: {}
}
},
“limit”: {
“parallel”: 2,
“fetchSize”: 5000,
“batchSize”: 5000,
“bufferSize”: 8,
“cpBufferSize”: 8
},
“object”: {
“schemas”: [
“MOGDB”
]
},
“dataOnly”: false,
“schemaOnly”: false,
“reportFile”: “./report”
“debug”: false
}
- 迁移
3.1 创建目标库和用户
create user mogdb with sysadmin password ‘mogdb@1234’;
create database myorcl with owner mogdb;
3.2 修改访问控制文件
vim /opt/mogdb/data/dn/pg_hba.conf
host all hcode 192.168.80.12/32 sha256
3.3 重载访问控制
gs_ctl reload -D /opt/mogdb/data/dn
3.4 迁移
cd /dbdata/app/mtk/mtk_2.3.2_linux_amd64
./mtk check-config -c oracle2opengauss_file.json
./mtk -c oracle2opengauss.json