我想:从jdbc:oracle数据库中将表导出到Beeline(CLI)中以逗号分隔的csv文件中 我尝试了bcp失败。 我已经试过-beeline> bcp“ select * from db_name.table_name” queryout“ /home/feed/data/ ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我有一个shell脚本代码,可以自动执行beeline命令。 该代码能够连接到JDBC,但是它位于那儿,似乎不执行Shell脚本中的其他代码,即。 它不会截断表,不会加载数据,不会插入。 下面是整个代码:
#! /bin/bash
timestamp=$(date +%Y-%m-%d-%H:%M:%S:%N)
unix_time=$(date +%Y-%m-%d-%H:%M:%S)
export
BEELINE_PREFIX='"jdbc:hive2://server:port,server:port,server:port/;serviceDiscoveryMode=zookeeper;zookeeperNamespace=hiveser
ver2;principal=hive/server@hello.COM"'
beeline -u $BEELINE_PREFIX -e use next;
echo "truncating the staging table tbl1..."
beeline -u $BEELINE_PREFIX -e "TRUNCATE TABLE next.tbl1;"
echo "Loading the data in stating table tbl1"
beeline -u $BEELINE_PREFIX -e "LOAD DATA LOCAL INPATH 'path_to/tbl1.txt' INTO TABLE next.tbl1;"
echo "Appending the data into history table tbl1.."
beeline -u $BEELINE_PREFIX -e "insert into table next.hist_tbl1 select *,'$unix_time' from next.tbl1;"
When I execute ./tbl1.sh
我可以看到以下输出:
Connecting to
jdbc:hive2://jdbc:hive2://server:port,server:port,server:port/;serviceDiscoveryMode=zookeeper;zookeeperNamespace=hiveserver2
;principal=hive/server@hello.COM
Connected to: Apache Hive
Driver: Hive JDBC
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
该代码似乎只执行veru第一个“ beeline -u”,即仅执行JDBC连接。 我已经注意到,当我使用ctrl + c时,它将前进并抛出错误以下
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. File file:/usr/ibmpacks/current/bigsql/hive/lib/hive-hbase-handler.jar does not exist (state=08S01,code=1)
任何想法,这是什么错误?
该问题已解决。 在使用配置单元数据库"use database".
之前,我在原始代码中使用beeline -u $BEELINE_PREFIX
额外行"use database".
我把它注释掉了。 脚本正常运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.