Oracle 之instant client

客户端要想连接oracle服务器,必须先安装oracle客户端,然而,普通的oracle客户端安装包较大,耗费时间长,若以有了oracle的精简客户端-instant client

1.下载安装包


http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html #选择对应的版本
通常下载的包有:
[root@jiang ~]# ls mypackages/
instantclient-basic-linux32-11.2.0.1.zip #基本的包
instantclient-sdk-linux32-11.2.0.1.zip  #客户端开发程序包,比如编译php连接oracle时需要用到,此处不是必须的包,但最好安装。
instantclient-sqlplus-linux32-11.2.0.1.zip #sqlplus安装包
#解压
for i in `ls | xargs`; do unzip $i; done
[root@jiang mypackages]# ls -d instantclient_11_2/ #解压后生成的目录
instantclient_11_2/

2.创建安装目录

useradd oinstall
useradd -g oinstall oracle && echo "123456" | passwd --stdin oracle
mkdir -p /opt/oracle
mv /root/instantclient_11_2 /opt/oracle
chown -R oracle.oinstall /opt/oracle

3.配置环境变量

export PATH=$PATH:$HOME/bin:/opt/oracle/instantclient_11_2
export ORACLE_HOME=/opt/oracle/instantclient_11_2 #家目录
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 #库文件目录
export TNS_ADMIN=/opt/oracle/network/admin/ #连接oracle服务器的配置文件
可自定义
[oracle@jiang admin]$ cat /opt/oracle/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
MYZABBIX =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = zabbix)
    )
  )

 当执行sqlplus测试连接时出现如下错误:

[root@jiang oracle]# sqlplus
sqlplus: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
#缺少安装包,解决方法如下
[root@jiang oracle]# yum -y install libaio
[oracle@jiang ~]$ sqlplus zabbix/zabbix@myzabbix  #连接成功
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 8 17:03:13 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@jiang ~]$ sqlplus scott/[email protected]:1521/zabbix
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 8 17:05:18 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
#sqlplus的另一连接方法






本文出自 “浪淘沙” 博客,谢绝转载!

Oracle 之instant client,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。