DataX从Hive将数据写入Oracle

本文详细解读了从HDFS读取数据并导入Oracle数据库的脚本,涉及HDFSReader处理CSV文件、列配置,以及OracleWriter连接参数和预处理SQL。重点在于数据迁移过程和技术细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、脚本

{
    "job": {
        "content": [
            {
                "reader": {
                    "name": "hdfsreader", 
                    "parameter": {
						"column": [
							{
								"index":0,
								"type":"STRING"
							},
							{
								"index":1,
								"type":"STRING"
							},
							{
								"index":2,
								"type":"STRING"
							},
							{
								"index":3,
								"type":"STRING"
							},
							{
								"index":4,
								"type":"STRING"
							},
							{
								"index":5,
								"type":"STRING"
							},
							{
								"index":6,
								"type":"STRING"
							},
							{
								"index":7,
								"type":"STRING"
							},
							{
								"index":8,
								"type":"STRING"
							},
							{
								"index":9,
								"type":"STRING"
							},
							{
								"index":10,
								"type":"STRING"
							},
							{
								"index":11,
								"type":"STRING"
							},
							{
								"index":12,
								"type":"STRING"
							},
							{
								"index":13,
								"type":"STRING"
							},
							{
								"index":14,
								"type":"STRING"
							},
							{
								"index":15,
								"type":"STRING"
							},
							{
								"index":16,
								"type":"STRING"
							},
							{
								"index":17,
								"type":"STRING"
							},
							{
								"index":18,
								"type":"STRING"
							},
							{
								"index":19,
								"type":"STRING"
							},
							{
								"index":20,
								"type":"STRING"
							},
							{
								"index":21,
								"type":"STRING"
							},
							{
								"index":22,
								"type":"STRING"
							},
							{
								"index":23,
								"type":"STRING"
							},
							{
								"index":24,
								"type":"DATE"
							},
							{
								"index":25,
								"type":"STRING"
							},
							{
								"index":26,
								"type":"DATE"
							}
                        ], 
                        "defaultFS": "hdfs://node01:9000", 
                        "encoding": "UTF-8", 
                        "fieldDelimiter": "|", 
                        "fileType": "text",
						"nullFormat":"",
                        "path": "/user/hive/warehouse/mask_data.db/health_code/*"
                    }
                }, 
                "writer": {
                    "name": "oraclewriter", 
                    "parameter": {
                        "column": [
							"ID_1",
							"NAME_1",
							"SN",
							"PASSPORT",
							"PHONE",
							"AREA",
							"STREET",
							"COMMUNITY",
							"ADDRESS",
							"CODE_TYPE",
							"APPLY_TYPE",
							"APPLY_MEMO",
							"AUDIT_MEMO",
							"AUDIT_STATUS",
							"AUDIT_TIME",
							"ATTACHMENT1",
							"ATTACHMENT2",
							"ADD_TIME",
							"CODE_ZM_TYPE",
							"AUDIT_STREET_MEMO",
							"AUDIT_AREA_MEMO",
							"UPDATE_TIME",
							"AUDIT_STREET_TIME",
							"AUDIT_AREA_TIME",
							"JLGXSJ12",
							"INC_ID",
							"RKSJ_CJYT"
						], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:oracle:thin:@//ip:1521/orcl", 
                                "table": ["HEALTH_CODE"]
                            }
                        ], 
                        "password": "xxxxx", 
                        "preSql": ["truncate table HEALTH_CODE"], 
                        "username": "root"
                    }
                }
            }
        ], 
        "setting": {
            "speed": {
                "channel": "3"
            }
        }
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值