具体操作步骤如下:
--1.在Oracle数据库创建表,并添加测试数据
create table test0825(name varchar2(20));
insert into test0825(name) values('6,test06');
insert into test0825(name) values('7,test07');
commit;
--2.在Hive中创建测试表,字段以逗号分隔
create table test0825(id int, name string)
row format delimited
fields terminated by ','
stored as textfile;
--3.使用sqoop导入数据到hive中
sqoop import -D mapred.job.queue.name=queue02 --connect jdbc:oracle:thin:@d0esdm.dbdev.paic.com.cn:1526:D0ESDM --username PA18ODSDATA --password pa182007 --table TEST0825 --hive-import --hive-table hduser0401.test0825 -m 1 --fields-terminated-by ',';
--4.启动hive,查看数据
[hduser0401@dev-l002782 ~]$ hive -S -e "select * from hduser0401.test0825";
16/08/25 16:46:09 INFO impl.MetricsConfig: loaded properties from hadoop-metrics2-hive.pr
--1.在Oracle数据库创建表,并添加测试数据
create table test0825(name varchar2(20));
insert into test0825(name) values('6,test06');
insert into test0825(name) values('7,test07');
commit;
--2.在Hive中创建测试表,字段以逗号分隔
create table test0825(id int, name string)
row format delimited
fields terminated by ','
stored as textfile;
--3.使用sqoop导入数据到hive中
sqoop import -D mapred.job.queue.name=queue02 --connect jdbc:oracle:thin:@d0esdm.dbdev.paic.com.cn:1526:D0ESDM --username PA18ODSDATA --password pa182007 --table TEST0825 --hive-import --hive-table hduser0401.test0825 -m 1 --fields-terminated-by ',';
--4.启动hive,查看数据
[hduser0401@dev-l002782 ~]$ hive -S -e "select * from hduser0401.test0825";
16/08/25 16:46:09 INFO impl.MetricsConfig: loaded properties from hadoop-metrics2-hive.pr