我是SQOOP 1.4.5的新手。我已经浏览了sqoop文档。我已经成功地将简单数据类型的记录导入/导出到hdfs。
下一步我为LOB DATA做了例子CLOB。
我有一个简单的CLOB表,Create Query如下......
CREATE TABLE “SCOTT”.”LARGEDATA” (“ID” VARCHAR2(20 BYTE), “IMG” CLOB ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE “USERS” LOB (“IMG”) STORE AS BASICFILE (TABLESPACE “USERS” ENABLE STORAGE IN ROW CHUNK 8192 RETENTION NOCACHE LOGGING );
我可以成功将数据导入hdsf
sqoop import –connect jdbc:oracle:thin:@:1522: –username –password –table ‘LARGEDATA’ -m 1 –target-dir /home/mydata/tej/LARGEDATA2 –fields-terminated-by , –escaped-by \\ –enclosed-by ‘\”‘
但是当我尝试使用以下命令将此数据导出到ORACLE时
sqoop export –connect jdbc:oracle:thin:@:1522: –username –password –table ‘LARGEDATA’ -m 1 –export-dir /home/mydata/tej/LARGEDATA2 –fields-terminated-by , –escaped-by \\ –enclosed-by ‘\”‘
我遇到了以下异常
java.lang.CloneNotSupportedException: com.cloudera.sqoop.lib.ClobRef at java.lang.Object.clone(Native Method)
java.io.IOException: Could not buffer record at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:218)
我谷歌关于它,并得到以下链接,提到sqoop不支持导出BLOB和CLOB数据。其中一些是2015年7月的帖子。并且一些jira问题显示它仍然打开。论坛链接如下......
https://issues.apache.org/jira/browse/SQOOP-991 Can sqoop export blob type from HDFS to Mysql? http://sofb.developer-works.com/article/19310921/Can+sqoop+export+blob+type+from+HDFS+to+Mysql%3F http://grokbase.com/t/sqoop/user/148te4tghg/sqoop-import-export-clob-datatype Exporting sequence file to Oracle by Sqoop
任何人都可以告诉我SQOOP是否支持导出LOB数据?如果是,那么请指导我如何做到这一点?
答案 0 :(得分:0)
尝试在oracle中创建一个临时表,并使用--staging-table --clear-staging-table。将staging table列保留为varchar2(10000)。