安装原因:python 连接Oracle的包cx_Oracle需要本机有Oracle客户端才可以运行
安装文件:
- oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
- oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm
- oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm
安装工具:
- alien
- 工具安装命令:sudo apt-get install alien
安装下载好的Oracle包(不分先后):
- sudo alien -i oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
- sudo alien -i oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm
- sudo alien -i oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm
配置环境变量:
- 打开配置文件:sudo vi /etc/profile
- 添加以下内容
export ORACLE_HOME="/usr/lib/oracle/19.5/client64"
export TNS_ADMIN="$ORACLE_HOME/network/admin"
export LD_LIBRARY_PATH="$ORACLE_HOME/lib"
export PATH="$ORACLE_HOME/bin:$PATH"
- 使环境变量生效:source /etc/profile
测试链接:
sqlplus 用户名/密码@DBNAME