1. 检查是否已经安装了Oracle客户端软件。
rpm -qa|grep oracle
2. 安装Oracle 11g客户端。
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
3. 配置环境变量。
vim /root/.bash_profile
#oracle
export ORACLE_BASE=/usr/lib/oracle
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
export ORACLE_SID=orcl
#export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
4. 刷新环境变量。
source /root/.bash_profile
5. 创建TNS文件。
mkdir /usr/lib/oracle/11.2/client64/network/
mkdir /usr/lib/oracle/11.2/client64/network/admin/
vim /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
#连接名
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
#服务器IP地址端口号
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.79.200)(PORT = 1521))
(LOAD_BALANCE = ON)
(FAILOVER = ON)
)
(CONNECT_DATA =
#连接字符串
(SERVICE_NAME = orcl)
(FAILOVER_MODE =
(TYPE = select)
(METHOD = basic)
(RETRIES = 5)
(DELAY = 1)
)
)
)
6. 安装完成