使用 Oracle 钱包从 Oracle 数据库获取数据时出现 Sqoop 错误
Sqoop error on data fetch from Oracle Database using Oracle wallet
sqoop import -D mapred.map.child.java.opts='-Doracle.net.tns_admin=. -Doracle.net.wallet_location=.' -files $HOME/wallet/cwallet.sso,$HOME/wallet/ewallet.p12,$HOME/wallet/sqlnet.ora,$HOME/wallet/tnsnames.ora --connect jdbc:oracle:thin:@TEST2 --table SQOOP_TEST
我正在使用此 sqoop 命令从 Oracle DB 获取数据,但以以下错误结尾
ERROR manager.SqlManager: Error executing statement: java.sql.SQLRecoverableException: IO Error: Unknown host specified
我的钱包:
tnsnames.ora
TEST2= (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA = (server=dedicated)
(SERVICE_NAME = HDPTEST )
) )
钱包工作正常,
$sqlplus /@TEST2
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 8 14:48:42 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release
11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
JDBC 没有 uding 钱包工作正常,
jdbc:oracle:thin:@:1521/HDPTEST
详细日志
Warning: /usr/local/hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/06/08 15:06:15 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/06/08 15:06:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/06/08 15:06:16 DEBUG tool.BaseSqoopTool: Enabled debug logging.
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Loaded manager factory: org.apache.sqoop.manager.oracle.OraOopManagerFactory
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Loaded manager factory: com.cloudera.sqoop.manager.DefaultManagerFactory
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Trying ManagerFactory: org.apache.sqoop.manager.oracle.OraOopManagerFactory
17/06/08 15:06:16 DEBUG oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop can be called by Sqoop!
17/06/08 15:06:16 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Trying ManagerFactory: com.cloudera.sqoop.manager.DefaultManagerFactory
17/06/08 15:06:16 DEBUG manager.DefaultManagerFactory: Trying with scheme: jdbc:oracle:thin
17/06/08 15:06:16 DEBUG manager.OracleManager$ConnCache: Instantiated new connection cache.
17/06/08 15:06:16 INFO manager.SqlManager: Using default fetchSize of 1000
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Instantiated ConnManager org.apache.sqoop.manager.OracleManager@1d2adfbe
17/06/08 15:06:16 INFO tool.CodeGenTool: Beginning code generation
17/06/08 15:06:16 DEBUG manager.OracleManager: Using column names query: SELECT t.* FROM SQOOP_TEST t WHERE 1=0
17/06/08 15:06:16 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : SELECT t.* FROM SQOOP_TEST t WHERE 1=0
17/06/08 15:06:16 DEBUG manager.OracleManager: Creating a new connection for jdbc:oracle:thin:@TEST2, using username: null
17/06/08 15:06:16 DEBUG manager.OracleManager: No connection paramenters specified. Using regular API for making connection.
17/06/08 15:06:16 ERROR manager.SqlManager: Error executing statement: java.sql.SQLRecoverableException: IO Error: Unknown host specified
java.sql.SQLRecoverableException: IO Error: Unknown host specified
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:662)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:560)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at org.apache.sqoop.manager.OracleManager.makeConnection(OracleManager.java:325)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:744)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)
at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)
at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:227)
at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1833)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1645)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Caused by: oracle.net.ns.NetException: Unknown host specified
at oracle.net.resolver.HostnameNamingAdapter.resolve(HostnameNamingAdapter.java:207)
at oracle.net.resolver.NameResolver.resolveName(NameResolver.java:131)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:476)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 24 more
17/06/08 15:06:16 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1651)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
请大家帮我看看哪里错了
类路径中是否有 oraclepki.jar、osdt_core.jar 和 osdt_cert.jar,请查看“SSL with JDBC”白皮书了解更多详情(第 9 页) .此外,钱包位置可以指定为 tnsnames.ora 的一部分,如此处所示。
LISTENER = (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcps)(HOST=servername)(PORT=2484))
) WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(
DIRECTORY=/server/wallet/path))
)
sqoop import -D mapred.map.child.java.opts='-Doracle.net.tns_admin=. -Doracle.net.wallet_location=.' -files $HOME/wallet/cwallet.sso,$HOME/wallet/ewallet.p12,$HOME/wallet/sqlnet.ora,$HOME/wallet/tnsnames.ora --connect jdbc:oracle:thin:@TEST2 --table SQOOP_TEST
我正在使用此 sqoop 命令从 Oracle DB 获取数据,但以以下错误结尾
ERROR manager.SqlManager: Error executing statement: java.sql.SQLRecoverableException: IO Error: Unknown host specified
我的钱包: tnsnames.ora
TEST2= (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA = (server=dedicated)
(SERVICE_NAME = HDPTEST )
) )
钱包工作正常,
$sqlplus /@TEST2
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 8 14:48:42 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
JDBC 没有 uding 钱包工作正常,
jdbc:oracle:thin:@:1521/HDPTEST
详细日志
Warning: /usr/local/hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/06/08 15:06:15 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/06/08 15:06:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/06/08 15:06:16 DEBUG tool.BaseSqoopTool: Enabled debug logging.
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Loaded manager factory: org.apache.sqoop.manager.oracle.OraOopManagerFactory
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Loaded manager factory: com.cloudera.sqoop.manager.DefaultManagerFactory
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Trying ManagerFactory: org.apache.sqoop.manager.oracle.OraOopManagerFactory
17/06/08 15:06:16 DEBUG oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop can be called by Sqoop!
17/06/08 15:06:16 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Trying ManagerFactory: com.cloudera.sqoop.manager.DefaultManagerFactory
17/06/08 15:06:16 DEBUG manager.DefaultManagerFactory: Trying with scheme: jdbc:oracle:thin
17/06/08 15:06:16 DEBUG manager.OracleManager$ConnCache: Instantiated new connection cache.
17/06/08 15:06:16 INFO manager.SqlManager: Using default fetchSize of 1000
17/06/08 15:06:16 DEBUG sqoop.ConnFactory: Instantiated ConnManager org.apache.sqoop.manager.OracleManager@1d2adfbe
17/06/08 15:06:16 INFO tool.CodeGenTool: Beginning code generation
17/06/08 15:06:16 DEBUG manager.OracleManager: Using column names query: SELECT t.* FROM SQOOP_TEST t WHERE 1=0
17/06/08 15:06:16 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : SELECT t.* FROM SQOOP_TEST t WHERE 1=0
17/06/08 15:06:16 DEBUG manager.OracleManager: Creating a new connection for jdbc:oracle:thin:@TEST2, using username: null
17/06/08 15:06:16 DEBUG manager.OracleManager: No connection paramenters specified. Using regular API for making connection.
17/06/08 15:06:16 ERROR manager.SqlManager: Error executing statement: java.sql.SQLRecoverableException: IO Error: Unknown host specified
java.sql.SQLRecoverableException: IO Error: Unknown host specified
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:662)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:560)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at org.apache.sqoop.manager.OracleManager.makeConnection(OracleManager.java:325)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:744)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)
at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)
at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:227)
at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:295)
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1833)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1645)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Caused by: oracle.net.ns.NetException: Unknown host specified
at oracle.net.resolver.HostnameNamingAdapter.resolve(HostnameNamingAdapter.java:207)
at oracle.net.resolver.NameResolver.resolveName(NameResolver.java:131)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:476)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 24 more
17/06/08 15:06:16 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1651)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
请大家帮我看看哪里错了
类路径中是否有 oraclepki.jar、osdt_core.jar 和 osdt_cert.jar,请查看“SSL with JDBC”白皮书了解更多详情(第 9 页) .此外,钱包位置可以指定为 tnsnames.ora 的一部分,如此处所示。
LISTENER = (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcps)(HOST=servername)(PORT=2484))
) WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(
DIRECTORY=/server/wallet/path))
)