分享

sqoop export 到oracle update出错

墨默滴 发表于 2016-10-21 16:14:23 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 1 12243
本帖最后由 墨默滴 于 2016-10-21 17:00 编辑

sqoop版本1.4.6
1) 全量导入 without updatekey 成功
sqoop export -D oraoop.oracle.rac.service.name=odsdb \
--connect jdbc:oracle:thin:@192.168.0.2:1521:odsdb1 \
--username user \
--password passwd  \
--table test \
--export-dir $hdfs_path \
--columns $clumns \
--input-fields-terminated-by '\t' \
--input-null-string '\\N' \
--input-null-non-string '\\N' \
-m 1

2) 添加update模式出错
sqoop export -D oraoop.oracle.rac.service.name=odsdb \
--connect jdbc:oracle:thin:@192.168.0.2:1521:odsdb1 \
--username user \
--password passwd  \
--table test \
--update-key id \
--update-mode allowinsert \

--export-dir $hdfs_path \
--columns $clumns \
--input-fields-terminated-by '\t' \
--input-null-string '\\N' \
--input-null-non-string '\\N' \
-m 1
error日志
Error: java.io.IOException: Can't export data, please check failed map task logs
        at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:112)
        at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
        at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
        at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1656)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.io.IOException: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
        at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:220)
        at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:46)
        at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write(MapTask.java:655)
        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 more
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
        at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1844)
        at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedStatement.java:10213)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.addBatch(OraclePreparedStatementWrapper.java:1362)
        at org.apache.sqoop.mapreduce.UpdateOutputFormat$UpdateRecordWriter.getPreparedStatement(UpdateOutputFormat.java:174)
        at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.execUpdate(AsyncSqlRecordWriter.java:149)
        at org.apache.sqoop.mapreduce.AsyncSqlRecordWriter.write(AsyncSqlRecordWriter.java:215)
        ... 15 more




已有(1)人评论

跳转到指定楼层
easthome001 发表于 2016-10-21 19:03:46
楼主看下map的日志,sqoop语句没看出什么问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条