一、liunx环境
1、系统版本:Red Hat 4.8.5-36
2、下载datax ,直接安装,解压可以
二、数据库及表的准备
1、oracle表,目前有3条数据;
2、mysql库建相对应的表及字段
三、准备Json文件并在datax中执行命令
编写好的json放到此目录下
json内容具体如下
{
"job": {
"setting": {
"speed": {
"channel": 4
}
},
"content": [{
"reader": {
"name": "oraclereader",
"parameter": {
"username": "1234",
"password": "1234",
"where": "",
"connection": [{
"querySql": [
"select id,name,idcard,create_time from person"
],
"jdbcUrl": ["jdbc:oracle:thin:@xxxxx:1521:orcl"]
}]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "root",
"column": [
"id",
"name",
"idcard",
"create_time"
],
"connection": [{
"jdbcUrl": "jdbc:mysql://xxxxx:3306/test1?useUnicode=true&characterEncoding=utf8",
"table": ["datax_person"]
}]
}
}
}]
}
}
回到
目录下
执行命令如下
python /opt/datax/bin/datax.py /opt/datax/job/xxx.json
执行结果
执行成功
标签:name,数据库,mysql,json,datax,Mysql,oracle From: https://www.cnblogs.com/fwfjava/p/17048228.html