Sqoop处理Oracle大字段BLOB

1、Oracle初始化数据

create table t_lob
(
a integer,
b clob,
c blob
)
   
insert into t_lob (a, b, c) values (1, 'clob測试',to_blob('3456'));
insert into t_lob (a, b, c) values (2, to_clob('clob測试'),to_blob('大数据'));
SELECT * FROM t_lob;

2、Hive创建表

create table ods.t_lob
(
a int,
b string,
c string
)
--partitioned by (batch_no string)
row format delimited fields terminated by '\t' 
lines terminated by '\n' stored as textfile;

3、执行Sqoop脚本

sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:oracle:thin:@IP:1521:orc' \
--username  用户名\
--password 密码 \
--table T_LOB \
--fields-terminated-by '\t' \
--lines-terminated-by '\n' \
--as-textfile \
--hive-import \
--hive-overwrite \
--delete-target-dir \
--hive-database ods \
--hive-table t_lob \
-m 1 \
--map-column-hive A=Integer,B=String,C=String

猜你喜欢

转载自blog.csdn.net/docsz/article/details/116303370