1、mkdir -p /opt/oracle
2、cd /opt/oracle
3、去oracle官网下载如下三个压缩包(最好下载与orcale服务器对应版本的)
然后传到/opt/oracle目录
oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip
oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip
oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip
官方地址如下:
http://www.oracle.com/technetwork/topics/linuxsoft-082809.html (32位)
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html (64位)
下载需要oracle账户,没有就免费注册一个吧。
4、将如下内容,复制粘贴到install.sh
#!/bin/bash
#author loopeelee
yum install -y libaio*
#不装这个包,连接的时候会报错如下:
#/opt/oracle/lib/sqlplus: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
cd /opt/oracle
unzip oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip > /dev/null 2>&1
unzip oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip > /dev/null 2>&1
mv instantclient_11_2/ lib
unzip oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip > /dev/null 2>&1
mv instantclient_11_2/ sdk
mkdir -p /opt/oracle/network/admin
cd /opt/oracle/network/admin
#下面的HOST = 和SERVICE_NAME = 需要根据自己值修改
echo ‘wcsracdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.22.8)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = uerdb)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)‘ > tnsnames.ora
echo ‘export ORACLE_HOME=/opt/oracle
export LD_LIBRARY_PATH=/opt/oracle/lib‘>> /etc/profile
source /etc/profile
5、chmod u+x install.sh
6、./install.sh
7、测试:
/opt/oracle/lib/sqlplus
也可以这样/opt/oracle/lib/sqlplus user/password@wcsracdb
本文出自 “噜噼哩” 博客,请务必保留此出处http://loopeelee.blog.51cto.com/9835110/1603663
Linux 免安装oracle客户端软件 连接 oracle数据库
原文地址:http://loopeelee.blog.51cto.com/9835110/1603663