sqoop 1.4

sqoop import --connect jdbc:oracle:thin:@192.168.31.222:1521:orcl --username shebaouser --password shebaouser --table ORG_PAY_INFO --num-mappers 2  --delete-target-dir --hive-import --hive-database bdd --hive-table ORG_PAY_INFO --hive-overwrite --fields-terminated-by '\t'
1.995 s BY01
sqoop import --connect jdbc:oracle:thin:@192.168.31.222:1521:orcl --username shebaouser --password shebaouser --table IY02 --num-mappers 10 --direct --target-dir /user/hive/warehouse/shebaouser --delete-target-dir --hive-import --hive-database bdd --hive-table IY02 --hive-overwrite --fields-terminated-by '\t'
2S iy02
sqoop import --connect jdbc:oracle:thin:@192.168.31.222:1521:orcl --username shebaouser --password shebaouser --table IY11 --num-mappers 10 --direct --target-dir /user/hive/warehouse/shebaouser --delete-target-dir --hive-import --hive-database bdd --hive-table IY11 --hive-overwrite --fields-terminated-by '\t'

--------------------------
a.sqoop create-hive-table --connect jdbc:oracle:thin:@192.168.31.222:1521:orcl --username shebaouser --password shebaouser --hive-table PEOPLE_BASE_INFO --table PEOPLE_BASE_INFO --fields-terminated-by '\t'

b.hive修改列类型,double格式在kettl中没法支持,需要修改为string
alter table org_base_info change id旧列名 id新列名 string comment 'id注释' first;

c.sqoop导入数据
sqoop import --connect jdbc:oracle:thin:@192.168.31.222:1521:orcl --username shebaouser --password shebaouser --table PEOPLE_PAY_INFO --num-mappers 2  --delete-target-dir --hive-import --hive-database default --hive-table PEOPLE_PAY_INFO --hive-overwrite --fields-terminated-by '\t'

如果没有主键,则需要指定--m 1,一个mapper

空值处理--null-string '\\N' --null-non-string '\\N'

d.hive 从hdfs中导入表数据

load data inpath '/user/hive/warehouse/shebaouser/org_base_info.txt' into table org_base_info;


e.如果hive执行where语句半天都没有结果,一直处于hang的状态时,检查各个组件的配置,如果是CDH,检查配置问题,纠正配置问题后就可以正常执行了。

------------------------------------------

spoon转换设置不传对应的头,分隔符使用\t

创建一个hive表,

create table 。。。。 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

------------------------------------------

如果出现用户权限的问题$ sudo -u hive sqoop import ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值