author:skate
time:2012/08/08
centos安装instantclient(oracle精简客户端)步骤
环境
os版本:centos5.5
kernel: 2.6.18-194.el5
下载软件包:
oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm
oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm
oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm
下载地址:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
指定rpm包的安装路径
1. 查看rpm包的默认安装路径
[root@localhost tmp]# rpm -qpl oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm
/usr/bin/sqlplus64
/usr/lib/oracle/10.2.0.5/client64/bin/sqlplus
/usr/lib/oracle/10.2.0.5/client64/lib/glogin.sql
3个包都需要检测,为了以后便于维护,可以把instantclient都装在目录"/oracle"
[root@localhost tmp]# rpm -ivh --relocate /usr=/oracle oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm
[root@localhost tmp]# rpm -ivh --relocate /usr=/oracle oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm
[root@localhost tmp]# rpm -ivh --relocate /usr=/oracle oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm
2.sqlnet.ora和tnsnames.ora创建
这两个文件默认是不存在,所以要手工创建
[root@localhost tmp]# mkdir -p /oracle/lib/oracle/10.2.0.5/client64/network/admin
然后在admin目录下创建这两个文件
3.配置环境变量
session级别设置
export LD_LIBRARY_PATH=/oracle/lib/oracle/10.2.0.5/client64/lib
export TNS_ADMIN=/oracle/lib/oracle/10.2.0.5/client64/network/admin
export ORACLE_HOME=/oracle/lib/oracle/10.2.0.5/client64
把如下内容放在环境变量文件中
[root@localhost ~]# vi /root/.bash_profile
.....
TNS_ADMIN=/oracle/lib/oracle/10.2.0.5/client64/network/admin
LD_LIBRARY_PATH=/oracle/lib/oracle/10.2.0.5/client64/lib
PATH=$PATH:$HOME/bin:/oracle/lib/oracle/10.2.0.5/client64/bin
......
4.测试
[root@localhost ~]# sqlplus "/@tns"
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Aug 9 03:03:26 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
------end----