Centos安装Oracle客户端

从这里”http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html”下载以下三个文件

instantclient-basic-Linux.x64-11.2.0.4.0.zip

instantclient-sdk-linux.x64-11.2.0.4.0.zip

instantclient-sqlplus-linux.x64-11.2.0.4.0.zip

新建并复制到Oracle文件夹下,自然解压后,会生成“instantclient_11_2”目录,basicsqlplus会在其根下,而sdk会在其下生成“sdk”目录;在其下建立目录“/network/admin”,创建文件:“tnsnames.ora”,并添加:

ORCL =

 (DESCRIPTION =

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

   (CONNECT_DATA =

     (SERVER = DEDICATED)

     (SERVICE_NAME = orcl)

   )

 )

配置:”sudo gedit /etc/profile

export ORACLE_HOME=/root/instantclient_11_2

export PATH=$ORACLE_HOME:$PATH

export TNS_ADMIN=$ORACLE_HOME/network/admin

export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH

export NLS_LANG=’SIMPLIFIED CHINESE_CHINA.AL32UTF8′

 运行:“source /etc/profile”使之生效

执行:sqlplus /nolog

结果:

u@ubuntu:~$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on星期二 3 31 23:35:222015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL>

    creating build/lib.linux-x86_64-3.5-11g

    gcc -pthread -shared build/temp.linux-x86_64-3.5-11g/cx_Oracle.o -L/root/instantclient_11_2 -lclntsh -o build/lib.linux-x86_64-3.5-11g/cx_Oracle.cpython-35m-x86_64-linux-gnu.so

    /usr/bin/ld: cannot find -lclntsh

    collect2: error: ld returned 1 exit status

    error: command ‘gcc’ failed with exit status 1

解决方法:ln -s /root/instantclient_11_2/libclntsh.so.11.1 /root/instantclient_11_2/libclntsh.so