1. 下载安装包
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.zip
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.zip
oracle-instantclient11.2-sdk-11.2.0.4.0-1.x86_64.zip
2. 解压到opt/oracle
3.在 instantclient_11_2 目录下创建 network/admin 目录,使用命令
mkdir -p network/admin
4. 并在 admin 目录下创建 tnsnames.ora 文件(如果不用数据库连接软件,好像不需要)
ZKL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 111.111.111.111)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
5. 配置用户变量vim ~/.bashrc
ORACLE_HOME=/opt/oracle/instantclient_11_2
PATH=$ORACLE_HOME:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_HOME PATH LD_LIBRARY_PATH
6. 配置完毕后,进行刷新环境变量,进行生效source ~/.bashrc
测试sqlplus /nolog
出现下面结果
SQL*Plus: Release 11.2.0.4.0 Production on 星期二 1月 5 11:14:31 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL>