Ошибка Sqoop при получении данных из базы данных Oracle с использованием кошелька Oracle
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, но заканчивается с ошибкой ниже
ОШИБКА manager.SqlManager: Ошибка при выполнении оператора: java.sql.SQLRecoverableException: ошибка ввода-вывода: указан неизвестный хост
Мой кошелек:tnsnames.ora
TEST2= (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA = (server=dedicated)
(SERVICE_NAME = HDPTEST )
) )
Кошелек работает нормально,
$ sqlplus / @ TEST2
SQL * Plus: выпуск 11.2.0.4.0, производство, четверг, 8 июня 14:48:42 2017
Copyright (c) 1982, 2013, Oracle. Все права защищены.
Соединено с: Oracle Database 11g Enterprise Edition, выпуск 11.2.0.4.0 - 64-битное производство с опциями Partitioning, OLAP, Data Mining и Real Application Testing
SQL>
JDBC без бумажника работает нормально,
JDBC: оракул: тонкий:@: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)
Пожалуйста, помогите мне выяснить, где я не прав.
1 ответ
У вас есть oraclepki.jar, osdt_core.jar и osdt_cert.jar в пути к классам, а также, пожалуйста, ознакомьтесь с техническим документом " SSL с 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))
)