Sqoop连接Oracle导入数据到hive。
–导入所有表
sqoop import-all-tables –connect jdbc:oracle:thin:@10.3.60.123:1521:xdc –username PDCA –password XXXXX –hive-database DEFAULT -m 1 –create-hive-table –hive-import –hive-overwrite
–导入单个表
sqoop import –hive-import –connect jdbc:oracle:thin:@10.3.60.123:1521:xdc –username pdca –password XXXXX–table PDCA_MES_LINE_T –hive-database default -m 1 –create-hive-table –hive-import –hive-overwrite
–指定字段,单独输入密码
sqoop import –connect jdbc:oracle:thin:@10.3.60.123:1521:xdc –username pdca –P –table PDCA_MES_LINE_T –columns ‘MES_LINE_CODE,MES_LINE_NAME’ –create-hive-table -target-dir /opt/hive2.1.1//tmp -m 1 –hive-table PDCA_MES_LINE_T_Test –hive-import — –default-character-set=utf-8
–指定字段,不单独指定密码
sqoop import –connect jdbc:oracle:thin:@10.3.60.123:1521:xdc –username pdca –password XXXXX–table PDCA_MES_LINE_T –columns ‘MES_LINE_CODE,MES_LINE_NAME’ –create-hive-table -target-dir /opt/hive2.1.1//tmp -m 1 –hive-table PDCA_MES_LINE_T_Test1 –hive-import — –default-character-set=utf-8