Oracle Instant Client的安装和使用
Posted 小甜瓜安东泥
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle Instant Client的安装和使用相关的知识,希望对你有一定的参考价值。
转自:https://www.cnblogs.com/chinalantian/archive/2011/09/09/2172145.html
根据自己需求到Oracle网站(http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html)下载相应的Instant Client版本软件包,各软件包的描述如下:
Instant Client Package |
Description |
Notes |
Basic |
All files required to run OCI, OCCI, and JDBC-OCI applications |
|
Basic Lite |
Smaller version of the Basic, with only English error messages and Unicode, ASCII, and Western European character set support (10.2 only) |
|
JDBC Supplement* |
Additional(附加的) support for XA, Internationalization, and RowSet operations under JDBC |
|
SQL*Plus* |
Additional libraries and executable(可执行的) for running SQL*Plus with Instant Client |
|
ODBC Supplement* |
Additional(附加的) libraries for enabling ODBC applications with Instant Client (Not all platforms) |
|
SDK* |
Additional header files and an example makefile for developing Oracle applications with Instant Client |
|
ODAC* |
Includes ODP.NET, Oracle Services for MTS, Oracle Providers for ASP.NET, Oracle Provider for OLE DB, and OO4O with Oracle Instant Client |
|
标*的为可选软件包。
1、以11.2.0.2.0版本为例,下载Basic软件包(要支持中文只能下载Basic软件包)
2、解压缩必须包到C:\\Oracle\\instantclient_11_2
3、设置环境变量:
NLS_lANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
TNS_ADMIN=C:\\Oracle\\instantclient_11_2
Path=C:\\Oracle\\instantclient_11_2;%Path%
为避免访问数据库时出现中文乱码,NLS_lANG的设置很重要;TNS_ADMIN如不设置,tnsnames.ora默认寻址为Instant Client目录下的network\\ADMIN目录;%Path%为原有Path变量。
4、参照下面内容编写tnsnames.ora,并保存到安装目录:C:\\Oracle\\instantclient_11_2
# TNSNAMES.ORA Network Configuration File: C:\\oracle\\ora90\\network\\admin\\tnsnames.ora
# Generated by Oracle configuration tools.
#sample
#DATABASENAME =
# (DESCRIPTION =
# (ADDRESS_LIST =
# (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
# )
# (CONNECT_DATA =
# (SERVICE_NAME = servicename)
# )
# )
如果有要连接多个Oracle实例,请继续往该文件中加入其它实例的配置。
5、测试:
C:\\Oracle\\instantclient_11_2>sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Fri Sep 9 09:42:06 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> conn username/password @ <连接字符串>
至此,安装已经完成。PLSQL Developer等工具,以及应用软件都可以正常使用了。
附录:Linux下环境变量设置
如解压到了/usr/local/oracle目录,配置好TNS_ADMIN、LD_LIBRARY_PATH等,复制到.bashrc文件部分内容如下:
export ORACLE_HOME=/usr/local/oracle
export TNS_ADMIN=$ORACLE_HOME/NETWORK/ADMIN
export LD_LIBRARY_PATH=$ORACLE_HOME
export SQLPATH=$ORACLE_HOME
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
PATH=$PATH:$ORACLE_HOME
export PATH
以上是关于Oracle Instant Client的安装和使用的主要内容,如果未能解决你的问题,请参考以下文章
Oracle Instant Client(即时客户端) 安装与配置
本机不安装Oracle客户端,使用PL/SQL Developer和 Instant Client 工具包连接oracle 11g远程数据库
oracle instant client,tnsping,tnsnames.ora和ORACLE_HOME
navicat连接oracle报错:ORA-12737 Instant Client Light:unsupported server character set ZHS16GBK