Sqoop ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: ORA-01005

[hadoop@hadoop03 lib]$ sqoop import --hive-import --connect jdbc:oracle:thin:@10.0.0.2:9999:orcl \
> --username USRERNAME \
> --password !@2021 \
-bash: !@2021: event not found
> --table EB_EMPLOYEE_OUTSIDE_INFO \
> --hive-import -m 2 \
> --hive-database sqooptohive;
Warning: /hadoop/install/sqoop-1.4.7.bin__hadoop-2.6.0/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
2021-12-27 11:03:04,620 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
2021-12-27 11:03:04,675 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
2021-12-27 11:03:04,675 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
2021-12-27 11:03:04,789 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
2021-12-27 11:03:04,810 INFO manager.SqlManager: Using default fetchSize of 1000
2021-12-27 11:03:04,815 INFO tool.CodeGenTool: Beginning code generation
2021-12-27 11:03:10,667 ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: ORA-01005: null password given; logon denied

java.sql.SQLException: ORA-01005: null password given; logon denied

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:441)
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:436)
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1061)
        at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:550)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:499)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1279)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:663)
        at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at org.apache.sqoop.manager.OracleManager.makeConnection(OracleManager.java:329)
        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:763)
        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:786)
        at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:289)
        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:260)
        at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:246)
        at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:327)
        at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1872)
        at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1671)
        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
        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:234)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
2021-12-27 11:03:10,671 ERROR tool.ImportTool: Import failed: java.io.IOException: No columns to generate for ClassWriter
        at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1677)
        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
        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:234)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:252)

SQOOP 在导入数据时出错,问题的原因是由于密码中有特殊的字符导致

解决方案

只需要将密码使用双引号或者是单引号抱起来即可

[hadoop@hadoop03 lib]$ sqoop import --hive-import --connect jdbc:oracle:thin:@10.0.254.154:9999:yianju \
> --username YAJLMDM \
> --password 'Eaj!@2021' \
-bash: !@2021: event not found
> --table EB_EMPLOYEE_OUTSIDE_INFO \
> --hive-import -m 2 \
> --hive-database sqooptohive;

这样就不会出错了

上一篇:Sqoop将Hive数据导入MySQL异常


下一篇:【大数据面试】sqoop:空值、数据一致性、列式存储导出、数据量、数据倾斜