CentOS 7环境部署(4)——Oracle客户端

一、环境介绍
操作系统:centos7.6(64位)
Oracle客户端的版本:Oracle 11
使用工具:Xshell、Xftp
二、安装Oracle客户端
1.下载地址
https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
2. 根据oracle的版本下载对应的rpm包

A. oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
B. oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
C.oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm

3.安装相应的包
rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

4.修改环境变量

A. vim /root/.bash_profile
B. 末尾添加:
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib

C.source /root/.bash_profile
D.echo $ORACLE_HOME;

5. 新建软连接
cd /usr/lib/oracle/11.2/client64/lib && ln –s libclntsh.so.11.1 libclntsh.so

三、安装cx_Oracle扩展包
1.安装cx_Oracle
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn cx_Oracle

2.测试连接
python -c “import cx_Oracle”
不报错说明引入cx_Oracle成功。
注意:" "是英文状态下的引号。

原文地址:https://www.cnblogs.com/liu-xin1995/p/12364230.html