您好,登錄后才能下訂單哦!
#sqoop
解壓軟件
$ sudo tar -zxvf sqoop-1.4.6.bin__hadoop-0.23.tar.gz -C /usr/local/
$ pwd
/usr/local/sqoop-1.4.6.bin__hadoop-0.23
$ cd conf/
$ sudo cp sqoop-env-template.sh sqoop-env.sh
$ sudo vi sqoop-env.sh
export HADOOP_COMMON_HOME=/usr/local/hadoop-2.7.4/
export HADOOP_MAPRED_HOME=/usr/local/hadoop-2.7.4/
#sqoop 導入Oracle數據庫到HDFS中
$ sqoop import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger --table emp --columns 'empno,ename,job,sal,deptno' -m 1 --target-dir '/sqoop/emp'
#sqoop 導入Oracle到hive中
$ sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger --table emp -m 1 --columns 'empno,ename,job,sal,deptno'
#導入Oracle,并指明表名
$ sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger --table emp -m 1 --columns 'empno,ename,job,sal,deptno' --hive-table emp1
#導入Oracle,指定whare條件
$ sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger --table emp -m 1 --columns 'empno,ename,job,sal,deptno' --hive-table emp2 where 'deptno=10'
#導入Oracle,使用select
$ sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger -m 1 --query 'select * from emp where sal < 1000 and $CONDITIONS' --target-dir '/sqoop/emp3' --hive-table emp3
$ sqoop import --hive-import --connect jdbc:oracle:thin:@192.168.240.137:1521:orcl --username scott --password tiger -m 1 --table myemp --export-dir '/sqoop/emp3'
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。