一、下载
oracle linux_x86-64客户端下载地址:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
根据需要下载客户端的组件,通常我们在客户端上只需要用到sqlplus连接和查询命令,所以只需要下载basic和sqlplus两个rpm包即可,这里安装的是11.2.0.3版本在redhat linux7下
二、以root用户安装
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
添加oracle用户和目录
[chenyj@backup-server home]$ su -
Password:
[root@app-server ~]#
[root@app-server ~]# groupadd oinstall
[root@app-server ~]# groupadd dba
[root@app-server ~]# useradd -g oinstall -G dba oracle
[root@app-server ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@app-server ~]# mkdir -p /usr/lib/oracle/11.2/client64/network/admin
[root@app-server ~]# chown -R oracle:oinstall /usr/lib/oracle/
[root@app-server ~]# chmod -R 755 /usr/lib/oracle/
三、配置
[root@app-server ~]# su - oracle
[oracle@app-server ~]$ vi .bash_profile
umask 022
ORACLE_BASE=/usr/lib/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2/client64
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:/usr/lib/oracle:$PATH
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
SQLPATH=/usr/lib/oracle
TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
NLS_LANG="SimplifiedChinese_China.ZHS16GBK"
export SQLPATH TNS_ADMIN NLS_LANG
四、创建配置文件tnsname.ora和libs
前面已经在ORACLE_HOME目录下创建好目录network/admin,把数据库服务器上的tnsnames.ora拷贝过来即可
[oracle@app-server admin]$ su
密码:
[root@app-server admin]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib/oracle/11.2/client64/lib/ //添加此行
[root@app-server admin]# ldconfig
五、测试
[oracle@app-server admin]$ sqlplus test/123456@MYDATA
SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 1月 4 10:18:48 2017
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL>
测试成功!
注:
如果出现以下错误:
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
说明环境变量没有生效!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。