centos7.5安装oracle客户端

centos7.5安装oracle客户端

1.下载oracle客户端rpm安装包

下载地址:https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm

2.安装rpm包

sudo yum install oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
sudo yum install oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm

3.创建network/admin文件夹,上传 tnsnames.ora文件至创建的文件夹下

sudo mkdir -p /usr/lib/oracle/12.2/client64/lib/network/admin

TNS配置

ORCL172 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 162.21.151.151)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

4.建立环境变量

4.1创建oracle.sh文件

export PATH=/usr/lib/oracle/12.2/client64/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

4.2将oracle.sh文件上传至 /etc/profile.d 文件夹中

4.3加载环境变量

source /etc/profile

4.4查询环境变量

env |grep LD_LIBRARY_PATH
env |grep PATH

5.SQLPLUS测试

sqlplus sys/123456@123.123.123.123/orcl as sysdba
posted @ 2021-12-31 16:16  开怀的猫  阅读(307)  评论(0编辑  收藏  举报