1.hostnamectl set-hostname p164 --修改主机名
2.vim /etc/hosts --修改h
osts,否则出现
ORA-21561: OID generation failed,加入本机的解析
192.168.1.164 p164
3.安装--oracle instantclient依赖软件包即rzsz工具
yum -y install libaio bc flex blas
--安装rzsz工具,方便Xshell上传文件
yum -y install lrzsz
4.--上传软
件包 sqlplus basic devel 三个
rz
上传如下三个客户文件(去oracle官网下载)
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
5.--一次性安装
rpm -ivh oracle*
6.--建立ORA文件目录
mkdir -p /usr/lib/oracle/12.1/client64/network/admin
--修改.bashrc文件,建立环境变量
echo '# Convoluted undocumented Oracle bullshit.' >> $HOME/.bashrc
echo 'export ORACLE_VERSION="12.1"' >> $HOME/.bashrc
echo 'export ORACLE_HOME="/usr/lib/oracle/$ORACLE_VERSION/client64"' >> $HOME/.bashrc
echo 'export PATH=$PATH:"$ORACLE_HOME/bin"' >> $HOME/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$ORACLE_HOME/lib"' >> $HOME/.bashrc
echo 'export TNS_ADMIN="$ORACLE_HOME/network/admin"' >> $HOME/.bashrc
--解决sqlplus乱码
--echo 'export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"' >> $HOME/.bashrc
echo '
export NLS_LANG="
AMERICAN_AMERICA.UTF8
"'
>> $HOME/.bashrc
7.--更新环境变量
. $HOME/.bashrc
cd /usr/lib/oracle/12.1/client64/network/admin
--上传tnsnames.ora文件
rz
8.安装cx_Oracle
pip install cx_Oracle