利用sqoop将oracle 11g中的表迁移至hive表

转载:http://blog.csdn.net/mozart_cai/article/details/8596535

[Prerequisite]
hadoop, hive, sqoop installed
ojdbc6.jar was in directory /usr/lib/sqoop/lib (ojdbc6.jar is for JDK 1.6)
 
[Steps]
1. Install oracle 11g for 32bit on a windows 32bit vm (windows server 2003)
see < 在Windows Server 2003 32bit 中安装Oracle 11g 32bit>: http://blog.csdn.net/mozart_cai/article/details/8596352

2. Configure local listener(本地监听服务) in  oracle Net Manager, add a listener
see < 通过Net Manager 配置Oracle 11g本地监听服务(listener service)>: http://blog.csdn.net/mozart_cai/article/details/8596504

3. Load Oracle table to Hive table via Sqoop
In Oracle SQL Plus, check all tables owned by current user
SQL>  select unique tname from col;
We choose table "DEPT" to migrate.
 
In cluster node
$ hive
$ show tables;
$ quit;
$ sqoop import --connect jdbc:oracle:thin:@IPAddressOfNodeInstallOracle:1521:orcl --username SCOTT --password 123456 --table DEPT -m 1 --hive-import --hive-table "HIVETEST"
NOTICE: IPAddressOfNodeInstallOracle is for windows run oracle(ex: 172.16.3.4); username and password are configured in oracle;tablename and username should be upper case
$ show tables;
$ select * from hivetest;

你可能感兴趣的:(Sqoop)