Sqoop oracle 连接问题

Posted

技术标签:

【中文标题】Sqoop oracle 连接问题【英文标题】:Sqoop oracle connection issue 【发布时间】:2017-05-19 22:31:00 【问题描述】:

我正在尝试连接到 oracle 数据库以检查记录数。

Scenario-1:
    [user@hostname ingestion]$ sqoop eval --connect jdbc:oracle:thin:@//hostname_1:PORT_1/Service_1 --username USER --password PASSWORD --query 'select count(*) from SCHEMA_1.TABLE_1'
        class path is /usr/hdp/current/hive-client/lib/libthrift-0.9.3.jar:
        Warning: /usr/hdp/2.5.3.0-37/accumulo does not exist! Accumulo imports will fail.
        Please set $ACCUMULO_HOME to the root of your Accumulo installation.
        17/05/19 14:50:23 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.3.0-37
        17/05/19 14:50:25 INFO hdfs.PeerCache: SocketCache disabled.
        17/05/19 14:50:26 INFO manager.SqlManager: Using default fetchSize of 1000
        17/05/19 14:50:26 WARN tool.EvalSqlTool: SQL exception executing statement: java.sql.SQLException: Io exception: Oracle Error ORA-12650
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
            at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
            at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
            at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
            at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
            at java.sql.DriverManager.getConnection(DriverManager.java:571)
            at java.sql.DriverManager.getConnection(DriverManager.java:215)
            at org.apache.sqoop.manager.OracleManager.makeConnection(OracleManager.java:327)
            at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
            at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:64)
            at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
            at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
            at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:225)
            at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
            at org.apache.sqoop.Sqoop.main(Sqoop.java:243)

Scenario-2:
[user@hostname ingestion]$ sqoop eval --connect jdbc:oracle:thin:@//hostname_2:PORT_2/Service_2 --username USER --password PASSWORD --query 'select count(*) from SCHEMA_2.TABLE_2'
        class path is /usr/hdp/current/hive-client/lib/libthrift-0.9.3.jar:
        Warning: /usr/hdp/2.5.3.0-37/accumulo does not exist! Accumulo imports will fail.
        Please set $ACCUMULO_HOME to the root of your Accumulo installation.
        17/05/19 15:02:21 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.3.0-37
        17/05/19 15:02:23 INFO hdfs.PeerCache: SocketCache disabled.
        17/05/19 15:02:23 INFO manager.SqlManager: Using default fetchSize of 1000
        17/05/19 15:02:24 INFO manager.OracleManager: Time zone has been set to GMT
        ------------------------
        | COUNT(*)             | 
        ------------------------
        | 43                   | 
        ------------------------

第一个给我错误,而第二个给我预期的结果。

有人可以帮忙吗? jar使用ojdbc14-10.2.0.4.0.jar

【问题讨论】:

尝试从 ojdbc14-10.x.x.x.x 更新到 ojdbc14-11.x.x.x.x 【参考方案1】:

花了很长时间才发现问题。运行 Sqoop 的边缘节点无法远程登录,因为端口关闭(操作系统补丁在一周前完成,Linux 管理员关闭了端口并且没有打开它们)。 一旦端口在运行 sqoop 的边缘节点中打开,我就能够执行 sqoop eval

【讨论】:

以上是关于Sqoop oracle 连接问题的主要内容,如果未能解决你的问题,请参考以下文章

在不使用 Sqoop 的情况下在 HDFS 中加载 Oracle 数据

sqoop 从oracle抽数据是 sql怎么写

sqoop mysql数据变化怎么导入

使用 ojdbc6 连接器导入 Sqoop

如何用sqoop查看oracle的表

为 Sqoop 导入禁用 Oraoop