1 下载客户端
官方下载地址:https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
下载
Basic Package (RPM)
SQL*Plus Package (RPM)
2 安装
# rpm -ivh oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
# rpm -ivh oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm
3 环境变量
#vi ~/.bash_profile export ORACLE_BASE=/usr/lib/oracle/19.5 export ORACLE_HOME=$ORACLE_BASE/client64 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export TNS_ADMIN=$ORACLE_BASE/admin export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
4 配置TNS
# mkdir -p $ORACLE_HOME/network/admin # vi $ORACLE_HOME/network/admin/tnsnames.ora alias = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
注意该文件格式要求严格,缩进必须为空格,否则会报解析错误;
5 SQLPLUS测试
# sqlplus xxx/xxx@alias