Ubuntu下安装oracle客户端
1) 下载zip包
a. instantclient-basic-linux.x64-11.2.0.4.0.zip
b. instantclient-jdbc-linux.x64-11.2.0.4.0.zip
c . instantclient-sdk-linux.x64-11.2.0.4.0.zip
d. instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
2) 解压到目录
a=> /usr/lib/oracle/11.2/client64/lib
b=> /usr/lib/oracle/11.2/client64/lib
c=> /usr/lib/oracle/11.2/client64/sdk
d=>/usr/lib/oracle/11.2/client64/lib
创建目录和文件连接:
$ sudo mkdir -p /usr/lib/oracle/11.2/client64/sqlplus/mesg
$ cd /usr/lib/oracle/11.2/client64/lib
$ sudo ln -s libclntsh.so.11.1 libclntsh.so
$ sudo ln -s libocci.so.11.1 libocci.so
$ sudo chown cl:cl ./*.so
$ sudo chmod 755 ./*.so
3) tnsnames.ora
$ sudo vi /usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora
内容如下:
ORADBSID =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ???.xxx.???.???)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
4) 配置 /etc/profile
# oracle 11g client x64
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/lib:$ORACLE_HOME/sdk/include
export ORACLE_SID=ORADBSID
export NLS_LANG="american_america.ZHS16GBK"
使生效:
. /etc/profile
5) 打开sqlplus
$ sqlplus user/password@ORADBSID sql*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 23:43:08 2017 Copyright (c) 1982,2013,Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning,OLAP,Data Mining and Real Application Testing options
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。