Sqoop将Hive字符串导出到Oracle CLOB

时间:2016-06-08 05:29:27

标签: oracle hive sqoop

我想将来自Hive的 STRING 数据导出到Oracle中的 CLOB

命令:

sqoop export -Dsqoop.export.records.per.statement=1 --connect 'jdbc:oracle:thin:@192.168.41.67:1521:orcl' --username ILABUSER --password impetus --table ILABUSER.CDT_ORC_1 --export-dir /user/dev/db/123 --input-fields-terminated-by '\001' --input-null-string '\\N' --input-null-non-string '\\N' -m 2

例外:

  

错误:java.io.IOException:无法导出数据,请检查失败的地图任务日志       at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:112)       at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)       在org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:146)       在org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)       在org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)       在org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)       在org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild.java:164)       at java.security.AccessController.doPrivileged(Native Method)       在javax.security.auth.Subject.doAs(Subject.java:422)       在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)       在org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)   引起:java.io.IOException:无法缓冲记录       在org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:218)       at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:46)       在org.apache.hadoop.mapred.MapTask $ NewDirectOutputCollector.write(MapTask.java:658)       at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(TaskInputOutputContextImpl.java:89)       at org.apache.hadoop.mapreduce.lib.map.WrappedMapper $ Context.write(WrappedMapper.java:112)       at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:84)       ......还有10个   引起:java.lang.CloneNotSupportedException:com.cloudera.sqoop.lib.ClobRef       at java.lang.Object.clone(Native Method)       在org.apache.sqoop.lib.LobRef.clone(LobRef.java:109)       在ILABUSER_CDT_ORC_1.clone(ILABUSER_CDT_ORC_1.java:322)       在org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:213)       ......还有15个

1 个答案:

答案 0 :(得分:0)

作为一种解决方法,我使用了--map-column-java标记。

我将 Clob列(名为col_clob)映射到Java中的String。

在上面的命令中添加了以下代码:

--map-column-java tag col_clob=String