Oracle JDBC 连接hive

manual: https://docs.cloudera.com/documentation/enterprise/5-6-x/topics/cdh_ig_hive_metastore_configure.html

 

安装环境:CENOS8

1)安装JDBC DRIVER

Oracle Database 19c (19.6) JDBC Driver & UCP Downloads

https://www.oracle.com/database/technologies/appdev/jdbc-ucp-19-6-c-downloads.html

 因为下载的是18c的express edition,所以点击18c行下载对应的drivers:https://www.oracle.com/database/technologies/appdev/jdbc-ucp-183-downloads.html

Oracle JDBC 连接hive

 名称:ojdbc8-full.tar.gz

 [root@bigdata Downloads]# tar zxf ojdbc8-full.tar.gz

[root@bigdata Downloads]# cd ojdbc8-full/

 

[root@bigdata ojdbc8-full]# cp ojdbc8.jar /home/admin/Downloads/apache-hive-2.3.7/lib

[root@bigdata lib]# pwd
/home/admin/Downloads/apache-hive-2.3.7/lib

[root@bigdata lib]# ls |grep ojdbc
ojdbc8.jar

 

2)安装oracle express edition

安装教程:https://docs.oracle.com/en/database/oracle/oracle-database/18/xeinl/procedure-installing-oracle-database-xe.html

下载安装包:https://www.oracle.com/database/technologies/appdev/xe.html

oracle-database-xe-18c-1.0-1.x86_64.rpm

Oracle JDBC 连接hive

 

在CentOS8,需要设置个参数才能看到sharefolder。输入:

/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

[root@bigdata] cd /mnt/hgfs/ShareFolder

下载oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

# curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

 

安装oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

 

执行报错
[root@bigdata ShareFolder]# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm Last metadata expiration check: 0:07:08 ago on Wed 20 May 2020 07:36:26 PM CST. Error: Problem: conflicting requests - nothing provides compat-libcap1 needed by oracle-database-preinstall-18c-1.0-1.el7.x86_64 - nothing provides compat-libstdc++-33 needed by oracle-database-preinstall-18c-1.0-1.el7.x86_64 (try to add --skip-broken to skip uninstallable packages or --nobest to use not only best candidate packages)

   如何解决 缺少2个需要的package? 

网友方案,但是我没有完全采纳。ref1:https://community.oracle.com/thread/4303249,其实只要把缺的包安装下就好了。

1)google compat-libcap1,有很多资源。我下载了compat-libcap1-1.10-7.el7.x86_64.rpm。

https://www.rpmfind.net/linux/rpm2html/search.php?query=compat-libcap1

Oracle JDBC 连接hive

[root@bigdata ShareFolder]# rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm

同理:下载compat-libstdc++-33: compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

[root@bigdata ShareFolder]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

 再次执行 yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm 安装成功!

Installed:
  oracle-database-preinstall-18c-1.0-1.el7.x86_64           ksh-20120801-253.el8_1.x86_64       
  sysstat-11.7.3-2.el8.x86_64                               libaio-devel-0.3.112-1.el8.x86_64   
  lm_sensors-libs-3.4.0-20.20180522git70f7e08.el8.x86_64    make-1:4.2.1-9.el8.x86_64           

Complete!

 

如果没有运行xx-preinstall-xxx.rpm,直接运行oracle-database-xe-xx.rpm会报错,如下:
[root@bigdata ShareFolder]
# yum -y localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm Last metadata expiration check: 0:08:33 ago on Wed 20 May 2020 07:36:26 PM CST. Error: Problem: conflicting requests - nothing provides oracle-database-preinstall-18c needed by oracle-database-xe-18c-1.0-1.x86_64 (try to add --skip-broken to skip uninstallable packages or --nobest to use not only best candidate packages)

安装oracle-database-xe-18c-1.0-1.x86_64.rpm 

 [root@bigdata ShareFolder]# yum -y localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm 

 

[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database XE, optionally modify the parameters in /etc/sysconfig/oracle-xe-18c.conf and then execute /etc/init.d/oracle-xe-18c configure as root.

  Verifying        : oracle-database-xe-18c-1.0-1.x86_64                                     1/1 

Installed:
  oracle-database-xe-18c-1.0-1.x86_64                                                            

Complete!  安装成功!

 

[root@localhost ShareFolder]#  /etc/init.d/oracle-xe-18c configure
The location /opt/oracle specified for database files has insufficient space.
Database creation needs at least 4.5GB disk space.
Specify a different database file destination that has enough space in the configuration file /etc/sysconfig/oracle-xe-18c.conf.

 

 

根据ref1中所述,需要yum install很多个文件,其实不用,比如下面这个安装就不用执行,它里面没有compat-libstdc++-33的包。

[root@bigdata ShareFolder]# yum install -y gcc-c++

Installed:
gcc-c++-8.3.1-4.5.el8.x86_64 cpp-8.3.1-4.5.el8.x86_64 
gcc-8.3.1-4.5.el8.x86_64 isl-0.16.1-6.el8.x86_64 
libstdc++-devel-8.3.1-4.5.el8.x86_64 glibc-devel-2.28-72.el8_1.1.x86_64 
glibc-headers-2.28-72.el8_1.1.x86_64 kernel-headers-4.18.0-147.8.1.el8_1.x86_64 
libxcrypt-devel-4.1.1-4.el8.x86_64

 

其他请忽略:

D:\Downloads\hive_jdbc_2.5.20\2.5.20.1060\ClouderaHiveJDBC-2.5.20.1060\ClouderaHiveJDBC41-2.5.20.1060

Oracle JDBC 连接hive

上一篇:Oracle X$ Tables介绍


下一篇:MongoDB 数据类型