Oracle Instant Client的安装和使用(一)

2014-11-24 12:27:38 · 作者: · 浏览: 2

Oracle Instant Client的安装和使用
根据自己需求到Oracle网站(http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html) 下载相应的Instant Client版本软件包,各软件包的描述如下:
Instant Client Package
Description www.2cto.com
Notes
Basic
All files required to run OCI, OCCI, and JDBC-OCI applications
OCI http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10646/oci01int.htm#i423362
OCCI http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10764/install.htm#CACFFGHF
JDBC http://download.oracle.com/docs/cd/E11882_01/java.112/e16548/instclnt.htm#CIHFDFJC
Basic Lite
Smaller version of the Basic, with only English error messages and Unicode, ASCII, and Western European character set support (10.2 only)
OCI http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10646/oci01int.htm#i423362
OCCI http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10764/install.htm#CACFFGHF
JDBC http://download.oracle.com/docs/cd/E11882_01/java.112/e16548/instclnt.htm#CIHFDFJC
JDBC Supplement*
Additional(附加的) support for XA, Internationalization, and RowSet operations under JDBC
JDBC http://download.oracle.com/docs/cd/E11882_01/java.112/e16548/instclnt.htm#CIHFDFJC
SQL*Plus*
Additional libraries and executable(可执行的) for running SQL*Plus with Instant Client
SQL*Plus 10.2 www.2cto.com http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ape.htm#sthref3926
SQL*Plus 11.2 http://download.oracle.com/docs/cd/E11882_01/server.112/e16604/apd.htm#CHDCHJJJ
ODBC Supplement*
Additional(附加的) libraries for enabling ODBC applications with Instant Client (Not all platforms)
ODBC
http://www.oracle.com/technetwork/database/features/oci/odbc-ic-releasenotes-094306.html
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 www.2cto.com
#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目录,配置好