1.官网下载安装包
Oracle客户端安装包(19C版本)下载地址:
https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
2.切换至root用户,将安装包放在根目录的 opt/oracle下
3.执行安装命令 ,rpm -ivh rpm包名,安装顺序注意一下,basic、devel,其他的随意。安装完成后会在根目录下的usr/lib下生产oracle目录。
安装命令:
rpm -ivh oracle-instantclient19.12-basic-19.12.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.12-devel-19.12.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.12-jdbc-19.12.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.12-odbc-19.12.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.12-sqlplus-19.12.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.12-tools-19.12.0.0.0-1.x86_64.rpm
4.root用户在/usr/lib/oracle/19.12/client64下创建tnsnames.ora文件
SID =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = XXXX))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XXXX)
)
)
5.配置环境变量
切换至普通用户,vi ~/.bash_profile 。添加如下内容。保存退出后,source ~/.bash_profile 刷新配置信息
export ORACLE_HOME=/usr/lib/oracle/19.12/client64
export TNS_ADMIN=/usr/lib/oracle/19.12/client64
export TNS=/usr/lib/oracle/19.12/client64
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:LD_LIBRARY_PATH
export PATH=$PATH_HOME/bin:$ORACLE_HOME/bin:$ORACLE_HONE/lib
export DB_SERVER=ORCL
6.验证部署结果
继续普通用户,使用命令 sqlplus username/passwd@SID 验证,能正常登陆数据库即为安装成功。
sqlplus USERNAME/PASSED@ORCL