美文网首页程序员
ubuntu服务器安装ORACLE INSTANT CLIENT

ubuntu服务器安装ORACLE INSTANT CLIENT

作者: 开飞机的贝吉塔 | 来源:发表于2018-11-07 17:12 被阅读0次

1 在ubuntu服务器上安装alien工具

apt-get install alien build-essential

2 下载oracle instant client所需rpm包

https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下载所需rpm包,
包括:
oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
这三个rpm包。

3 将下载好的rpm 转换成deb并安装

alien -i oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
alien -i oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
alien -i oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

4 配置

sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig

5 环境变量配置

vi ~profile
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib/:$LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin

最后保存

6 导入环境变量

source ~profile

7 python脚本测试

import cx_Oracle
db = cx_Oracle.connect('user/password@ip:port/ORCL')
print(db.version)

参考资料

https://oracle.github.io/odpi/doc/installation.html#oracle-instant-client-rpm

相关文章

网友评论

    本文标题:ubuntu服务器安装ORACLE INSTANT CLIENT

    本文链接:https://www.haomeiwen.com/subject/tkqreftx.html