hive的表:bigdata.emp_dongtai
oracle的表:EMP_FROM_H
#!/bin/sh
#使用shell脚本结合sqoop命令,进行一个Hive分区表格的数据导出到oracle的操作
for i in `hive -e”show partitions bigdata.emp_dongtai“` #查看表的分区数据
do
echo $i
sqoop export –connect jdbc:oracle:thin:@192.168.2.199:1521:ORCL –username py –password 123123 –table EMP_FROM_H –export-dir /user/hive/warehouse/bigdata.db/emp_dongtai/$i –fields-terminated-by ‘/001’ –lines-terminated-by ‘/n’ –input-null-string ‘//N’ –input-null-non-string ‘//N’
done
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/275004.html