How hadoop hive and Oracle import data from each other
This article is about how hadoop hive and Oracle import data into each other. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
# 1. Set up the table to be processed on Oracle, create table SOURCE_TABLE_NAME as SELECT t. Alter table SOURCE_TABLE_NAME add constraint SOURCE_TABLE_NAME_P primary key (ROW_NUM); # 2. Set up the processing result table on Oracle and import DEST_TABLE_NAME#3.oracle into hadoopnohup\ sqoop import\-- hive-import\-- connect jdbc:oracle:thin:@192.168.1.14:1521:oradb1\-- username USER1\-- password "password"\-- verbose-m 32\-- table SOURCE_TABLE_NAME\-- hive-table db_hive.SOURCE_TABLE_NAME\-- fields-terminated-by'\ t'\-- lines-terminated-by'\ n'. Calculate hive-e "drop table db_hive.DEST_TABLE_NAME Create table db_hive.DEST_TABLE_NAME row format delimited fields terminated by't 'STORED AS TEXTFILE as\ select\ max (Dn) as Dn,\ EutranCellTdd_uk,\ max (EutranCellTdd_name) as EutranCellTdd_name,\ max (GsmRelation) as GsmRelation,\ adj_uk,\ max (adj_name) as adj_name,\ max (EnbFunction_uk) as EnbFunction_uk,\ max (EnbFunction_name) as EnbFunction_name,\ max (ManagedElement_uk) as ManagedElement_uk \ max (ManagedElement_name) as ManagedElement_name,\ max (omc_uk) as omc_uk,\ max (omc_name) as omc_name,\ sum (HO_ToGsmAttOutPerRelation) as HO_ToGsmAttOutPerRelation,\ sum (HO_ToGsmSuccOutPrepPerRelation) as HO_ToGsmSuccOutPrepPerRelation,\ sum (HO_ToGsmSuccOutPerRelation) as HO_ToGsmSuccOutPerRelation,\ max (VENDOR_UK) as VENDOR_UK,\ max (VENDOR_NAME) as VENDOR_NAME \ max (city_name) as city_name\ from db_hive.SOURCE_TABLE_NAME\ group by EutranCellTdd_uk, adj_uk "# 5.hadoop export oracle (destination table DEST_TABLE_NAME needs to be cleared) sqoop export\-- connect jdbc:oracle:thin:@192.168.1.14:1521:oradb1\-- username USER1\-- password" password "table DEST_TABLE_NAME\-- export-dir / user/hive/warehouse/db_hive.db/DEST_TABLE_NAME\-- input-fields-terminated-by'\ t'\-- input-lines-terminated-by'\ Null-string'--null-non-string'--Thank you for your reading! This is the end of the article on "how hadoop hive and Oracle import data from each other". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!