Oracle資料匯入到Hive資料庫的操作方法
具體操作步驟如下:
--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.properties
16/08/25 16:46:09 INFO impl.MetricsSinkAdapter: Sink mysink0 started
16/08/25 16:46:10 INFO impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
16/08/25 16:46:10 INFO impl.MetricsSystemImpl: Scheduled snapshot period at 1 second(s).
16/08/25 16:46:10 INFO impl.MetricsSystemImpl: hive metrics system started
test0825.id test0825.name
6 test06
7 test07
--補充:如果test0825中的欄位是以\001分隔,那麼匯入命令為:
--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.properties
16/08/25 16:46:09 INFO impl.MetricsSinkAdapter: Sink mysink0 started
16/08/25 16:46:10 INFO impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
16/08/25 16:46:10 INFO impl.MetricsSystemImpl: Scheduled snapshot period at 1 second(s).
16/08/25 16:46:10 INFO impl.MetricsSystemImpl: hive metrics system started
test0825.id test0825.name
6 test06
7 test07
--補充:如果test0825中的欄位是以\001分隔,那麼匯入命令為:
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;
相關文章
- 把csv檔案的資料匯入到oracle資料庫中Oracle資料庫
- hive資料倉儲匯入資料的方法Hive
- Sqoop將MySQL資料匯入到hive中OOPMySqlHive
- 匯入excel資源到資料庫Excel資料庫
- Sql Server資料庫資料匯入到SQLite資料庫中Server資料庫SQLite
- HIVE資料匯入基礎Hive
- 將informix匯出的文字資料匯入oracle資料庫ORMOracle資料庫
- oracle 9i的資料庫的dmp匯入到10G資料庫Oracle資料庫
- Access 匯入 oracle 資料庫Oracle資料庫
- 定時將資料匯入到hive的shell指令碼Hive指令碼
- oracle資料庫匯入匯出命令!Oracle資料庫
- ORACLE資料庫裡表匯入SQL Server資料庫Oracle資料庫SQLServer
- Hive學習筆記 4 Hive的資料匯入Hive筆記
- Oracle資料庫的匯入和匯出命令Oracle資料庫
- GeoRapter工具將shapefile資料匯入到Oracle空間資料庫中APTOracle資料庫
- java 從EXCEL匯入到資料庫JavaExcel資料庫
- 從Excel到匯入MYSQL資料庫ExcelMySql資料庫
- 資料庫 MySQL 資料匯入匯出資料庫MySql
- oracle資料庫使用sqlldr命令匯入txt資料Oracle資料庫SQL
- oracle資料庫遠端不落地匯入本地資料庫Oracle資料庫
- Hive資料匯出Hive
- 資料庫的匯入匯出資料庫
- java 實現excel中的資料匯入到資料庫的功能JavaExcel資料庫
- IIS 日誌匯入到資料庫的方法資料庫
- pl/sql developer將excel資料匯入到資料庫中SQLDeveloperExcel資料庫
- 大文字資料,匯入匯出到資料庫資料庫
- Hive資料匯入HBase引起資料膨脹引發的思考Hive
- Oracle 資料匯入匯出Oracle
- oracle資料匯入匯出Oracle
- Oracle 巧用外部表將大量excel資料匯入資料庫OracleExcel資料庫
- oracle 備份資料庫,匯出資料庫Oracle資料庫
- sqoop導oracle資料庫的資料到hiveOOPOracle資料庫Hive
- 將excel中資料從window上匯入到linux中oracle資料庫ExcelLinuxOracle資料庫
- Oracle 資料匯入ExcelOracleExcel
- mysql 資料庫匯入匯出MySql資料庫
- MySQL資料庫匯入匯出MySql資料庫
- 遠端資料庫AWR 匯入到本地分析資料庫
- xml與資料庫中資料的匯入匯出XML資料庫