hive='/usr/bin/hive'
hive_database='xxxxx'
field_segmentation='\001'
external_storage_path='/user/hive/warehouse/xxx/odsxxx'
source_database='xxx'
source_username='xxx'
source_pwd='xxxx'
source_ip='xxx'
source_port='1521' if [ -n "$1" ] ;then
do_day=$1
else
do_day=`date -d "-1 day" +%F`
fi /usr/bin/sqoop import \
--connect "jdbc:oracle:thin:@//$source_ip:$source_port/$source_database" \
--username $source_username \
--password $source_pwd \
--query "select * from xxxx where \$CONDITIONS " \
--hive-delims-replacement '<br/>' \
--num-mappers 1 \
--fields-terminated-by $field_segmentation \
--target-dir $external_storage_path/xxxxxxxx_tmp \
--delete-target-dir \
--null-string '\\N' \
--null-non-string '\\N' \
--hive-import \
--hive-database $hive_database \
--hive-table xxxxxx \
--hive-overwrite \
--hive-partition-key dt \
--hive-partition-value $do_day