1. 检查是否已经安装了Oracle客户端软件。

  1. rpm -qa|grep oracle

2. 安装Oracle 11g客户端。

  1. rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
  2. rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
  3. rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm

image.png

3. 配置环境变量。

  1. vim /root/.bash_profile
  2. #oracle
  3. export ORACLE_BASE=/usr/lib/oracle
  4. export ORACLE_HOME=/usr/lib/oracle/11.2/client64
  5. export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
  6. export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
  7. export ORACLE_SID=orcl
  8. #export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

4. 刷新环境变量。

  1. source /root/.bash_profile

5. 创建TNS文件。

  1. mkdir /usr/lib/oracle/11.2/client64/network/
  2. mkdir /usr/lib/oracle/11.2/client64/network/admin/
  3. vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
  4. #连接名
  5. orcl =
  6. (DESCRIPTION =
  7. (ADDRESS_LIST =
  8. #服务器IP地址端口号
  9. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.79.200)(PORT = 1521))
  10. (LOAD_BALANCE = ON)
  11. (FAILOVER = ON)
  12. )
  13. (CONNECT_DATA =
  14. #连接字符串
  15. (SERVICE_NAME = orcl)
  16. (FAILOVER_MODE =
  17. (TYPE = select)
  18. (METHOD = basic)
  19. (RETRIES = 5)
  20. (DELAY = 1)
  21. )
  22. )
  23. )

6. 安装完成