使用说明
当用户配置了这一项之后,DataX系统就会忽略table,column
这些配置型,直接使用这个配置项的内容对数据进行筛选,例
如需要进行多表join后同步数据,使用select a,b from table_a
join table_b on table_a.id = table_b.id
当用户配置querySql时,OracleReader/MysqlReader直接忽略
table、column、where条件的配置,querySql优先级大于
table、column、where选项。
文章目录
- 1. 清空Oracle数据
- 2. 构建json
- 3. 执行脚本
- 4. 同步验证
- 5. 同步结果
1. 清空Oracle数据
Truncate TABLE OTBS1;
2. 构建json
vim querySql.json
{"job": {"setting": {"speed": {"channel": 5},"errorLimit": {"record": 0,"percentage": 0.02}},"content": [{"reader": {"name": "mysqlreader","parameter": {"connection": [{"querySql": ["select IDNO,COL1,COL2,COL3,DT,COL5,COL6,COL7,COL8,COL9,COL10 from otbs1 where IDNO <= 1000"],"jdbcUrl": ["jdbc:mysql://127.0.0.1:3306/datax"]}],"username": "root","password": "123456"}},"writer": {"name": "oraclewriter","parameter": {"column": ["IDNO","COL1","COL2","COL3","DT","COL5","COL6","COL7","COL8","COL9","COL10"],"connection": [{"jdbcUrl": "jdbc:oracle:thin:@192.xxx.xxx.xxx:1521:orcl","table": ["DB.OTBS1"]}],"username": "username","password": "password"}}}]}
}
3. 执行脚本
python /app/datax/bin/datax.py /app/datax/job/querySql.json
4. 同步验证
5. 同步结果
2021-06-23 14:22:12.186 [job-0] INFO JobContainer -
任务启动时刻 : 2021-06-23 14:22:01
任务结束时刻 : 2021-06-23 14:22:12
任务总计耗时 : 10s
任务平均流量 : 6.14KB/s
记录写入速度 : 100rec/s
读出记录总数 : 1000
读写失败总数 : 0