从hive导入到oracle(Hcatalog)

1.使用catalog的情况下:
  1. sqoop export --table tableName2 \ #oracle表
  2. --connect jdbc:oracle:thin:@127.0.0.1:1521:ORCL \
  3. --username username \ #oracle用户
  4. --password password \ #密码
  5. --hcatalog-database DB1 \ #catalog数据库
  6. --hcatalog-table tableName2 \ #catalog表
  7. --hcatalog-partition-keys p_month \ #
  8. --hcatalog-partition-values 2016-11 \
  9. --columns "serialno",\
  10. "contractstatus",\
  11. "rno",\
  12. "rname",\
  13. "stores",\
  14. "sname",\
  15. "etl_in_dt"

2.不使用catalog
  1. sqoop export --table tableName -connect jdbc:oracle:thin:@127.0.0.1:1521:ORCL
  2. --username userNameA --password pwd --export-dir sourceFile --columns "c1,c2,c3"
  3. --input-fields-terminated-by '\001' --input-lines-terminated-by '\n'

3.使用hcatalog要注意的地方
import时,不支持:
--hive-import
--hive-overwrite
import和export时不支持:
--export-dir
--target-dir
--warehouse-dir
--append
--as-sequencefile
--as-avrodatafile
--as-parquetfile

4.用hcatalog导入导出
$SQOOP_HOME/bin/sqoop import --connect <jdbc-url> -table <table-name> --hcatalog-table txn <other sqoop options>
$SQOOP_HOME/bin/sqoop export --connect <jdbc-url> -table <table-name> --hcatalog-table txn <other sqoop options>




























































posted on 2017-08-30 23:21  月饼馅饺子  阅读(4343)  评论(0编辑  收藏  举报

导航