一次用sqoop抽取oracle数据到hive时遇到的问题

前端之家收集整理的这篇文章主要介绍了一次用sqoop抽取oracle数据到hive时遇到的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

问题描述

抽取oracle中数据到hive时,报连接异常,如下:

Error: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.sqlRecoverableException: Io exception: Connection reset

at org.apache.sqoop.mapreduce.db.DBInputFormat.setDbConf(DBInputFormat.java:170)

at org.apache.sqoop.mapreduce.db.DBInputFormat.setConf(DBInputFormat.java:161)

at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73)

at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133)

at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:749)

at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)

at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.Subject.doAs(Subject.java:422)

at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1796)

at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

Caused by: java.lang.RuntimeException: java.sql.sqlRecoverableException: Io exception: Connection reset

at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection(DBInputFormat.java:223)

at org.apache.sqoop.mapreduce.db.DBInputFormat.setDbConf(DBInputFormat.java:168)

... 10 more

Caused by: java.sql.sqlRecoverableException: Io exception: Connection reset

at oracle.jdbc.driver.sqlStateMapping.newsqlException(sqlStateMapping.java:101)

at oracle.jdbc.driver.DatabaseError.newsqlException(DatabaseError.java:133)

at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:199)

at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:263)

at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:521)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:418)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)

at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)

at java.sql.DriverManager.getConnection(DriverManager.java:664)

at java.sql.DriverManager.getConnection(DriverManager.java:247)

at org.apache.sqoop.mapreduce.db.DBConfiguration.getConnection(DBConfiguration.java:302)

at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection(DBInputFormat.java:216)

... 11 more

Caused by: java.net.SocketException: Connection reset

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115)

at java.net.SocketOutputStream.write(SocketOutputStream.java:155)

at oracle.net.ns.DataPacket.send(DataPacket.java:150)

at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:180)

at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:169)

at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)

at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)

at oracle.net.ns.NetInputStream.read(NetInputStream.java:77)

at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1034)

at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1010)

at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:760)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:368)

... 19 more

按照sqoop官网的解决方添加参数

-Dmapred.child.java.opts="-Djava.security.egd=file:/dev/../dev/urandom"

问题没有得到解决,依然报错。

最后,将ojdbc6.jar 替换为ojdbc14.jar ,异常不再有了。

不知道什么原因。

猜你在找的Oracle相关文章