您的位置:首页 > 数据库 > Oracle

oracle/hive数据互导

2016-07-18 00:00 274 查看
Oracle -> hive

1.导出数据

sqluldr2.bin safe=yes user=ods/123456@TESTDB query="SELECT code,name,sex,test,department,month_id,day_id from ods.student where month_id='201509' and day_id='02'; " log="/home/hadoop/pu_test/student_20150902.log" field=0x01 ncharset="CHINESE_CHINA.ZHS16GBK" charset="UTF8" file="/home/hadoop/pu_test/student_20150902.txt"

2.导入数据

hive -e "use ods;load data local inpath '/home/hadoop/pu_test/student_20150902.txt' overwrite into table ODS.student partition (monthid='201509',dayid='02') ;"

Hive -> oracle

1.导出数据

hive -e "select * from student" >> local/student.txt

2.编写控制文件

Insert.ctl:

load data

infile 'd:\zzz\student.txt'

append into table student

fields terminated by ','

(code,name,sex,test,department)

3.导入数据

sqlldr psbc/psbc control=/opt/impora/ Insert.ctl direct=true parallel=true
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle hive 导入数据