具体配置是windows:oracle 11g;liunx为 Redhat, 集群配置hadoop 2.5,我按照你的也下载的是sqoop-1.4.6。
配置好sqoop,是使用sqoop对liunx中的mysql数据导入导出到hdfs,都没有报错。但使用sqoop调用windows环境安装的oracle数据库信息到hdfs,出现了如下问题:
[hadoop@MU01 bin]$ ./sqoop list-databases --connect jdbc:oracle:thin:@//202.117.77.129:1521/ORCL --username DATACENTER -P
17/10/23 08:47:35 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.5.2
Enter password:
17/10/23 08:47:38 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
17/10/23 08:47:38 INFO manager.SqlManager: Using default fetchSize of 1000
17/10/23 08:47:38 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.sqoop.manager.OracleManager.listDatabases(OracleManager.java:695)
at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:49)
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)
我查看了几种方法,大概解决方法是把oracle的jar包导入sqoop中,但没有解决我的问题。我有两个疑惑,是不是我安装的sqoop版本与oracle不对应,或者是集群的安全设置有权限。所以对这个报错,大家有什么理解吗?希望有朋友在工作之余 ,能帮我看看这个问题。
附录:我的、/etc/profile
#set oracle
export ORACLE_HOME=/home/hadoop/oracle
#export ORACLE_SID=ORCL
export LD_LIBRARY_PATH=/home/hadoop/oracle/lib
export SQLPATH=/home/hadoop/oracle/lib:${SQLPATH}
export TNS_ADMIN=/home/hadoop/oracle/network/admin:${TNS_ADMIN}
export PATH=$PATH:$LD_LIBRARY_PATH
#SQOOP
export SQOOP_HOME=/home/hadoop/sqoop-1.4.6
export LOGDIR=/home/hadoop/sqoop-1.4.6/logs
export PATH=$PATH:$SQOOP_HOME/bin:SQOOP_HOME/lib
#export PATH=/home/hadoop/hadoop/bin:$PATH
#export HADOOP_HOME=/home/hadoop/hadoop2
export HADOOP_HOME=/cauni/app/hadoop-2.6.0-cdh5.4.7
export SPARK_HOME=/cauni/app/spark-1.5.1-bin-hadoop2.6
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$SPARK_HOME/bin:$PATH