代码改变世界

Linux平台ORACLE INSTANT客户端安装

2012-05-19 22:57  潇湘隐者  阅读(7374)  评论(0编辑  收藏  举报

 

 

下载安装文件

先去ORACLE官方网站下载所需版本的Instant Client Package 和 Instant Client Package - SQL*Plus安装包,(千万注意版本)

http://www.oracle.com/us/solutions/linuxx86-64soft-092277.html

http://www.oracle.com/technetwork/topics/linuxsoft-082809.html

这两个地址分别是linux 32和64位操作系统的下载地址。我下载了如下几个安装文件

basic-10.2.0.4.0-linux-x86_64.zip

sqlplus-10.2.0.4.0-linux-x86_64.zip

解压安装包

首先把安装文件上传到Linux服务器,我放在/home/etl目录下。执行下面解压命令

 

etl@m1 ~]$unzip basic-10.2.0.4.0-linux-x86_64.zip

Archive: basic-10.2.0.4.0-linux-x86_64.zip

inflating: instantclient_10_2/BASIC_README

inflating: instantclient_10_2/classes12.jar

inflating: instantclient_10_2/genezi

inflating: instantclient_10_2/libclntsh.so.10.1

inflating: instantclient_10_2/libnnz10.so

inflating: instantclient_10_2/libocci.so.10.1

inflating: instantclient_10_2/libociei.so

inflating: instantclient_10_2/libocijdbc10.so

inflating: instantclient_10_2/ojdbc14.jar

[etl@m1 ~]$unzip sqlplus-10.2.0.4.0-linux-x86_64.zip

Archive: sqlplus-10.2.0.4.0-linux-x86_64.zip

inflating: instantclient_10_2/SQLPLUS_README

inflating: instantclient_10_2/glogin.sql

inflating: instantclient_10_2/libsqlplus.so

inflating: instantclient_10_2/libsqlplusic.so

inflating: instantclient_10_2/sqlplus

 

 

 

解压后,会在/home/etl/目录下,创建instantclient_10_2目录,sqlplus-10.2.0.4.0-linux-x86_64.zip也会解压到instantclient_10_2下,

配置环境变

在.bash_profile文件下面添加如下环境变量

#Add by Kerry 2012-04-24 for oracle client

export ORACLE_HOME=$HOME/instantclient_10_2

export TNS_ADMIN=$ORACLE_HOME

export PATH=$ORACLE_HOME:$PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

export NLS_LANGE="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

保存后运行source .bash_profile使配置文件及时生效

clip_image002

配置tnsnames.ora

在安装目录中创建一个tnsanmes.ora文件,

biwg =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.32.97)(PORT = 1521))

(CONNECT_DATA =

(SERVICE_NAME = wgods)

)

)

测试安装成功

不要安装了不同版本的instant client与instant sqlplus。否则有可能就会报如下错误

[etl@m1 instantclient_10_2]$ sqlplus /nolog

sqlplus: error while loading shared libraries: libclntsh.so.10.1: wrong ELF class: ELFCLASS64

 

参考了文档:http://wenku.baidu.com/view/c331440cba1aa8114431d9e0.html