码迷,mamicode.com
首页 > 数据库 > 详细

Oracle Instant Client的安装和使用

时间:2018-05-28 14:59:54      阅读:1656      评论:0      收藏:0      [点我收藏+]

标签:ora   nbsp   log   head   connect   tcl   sample   必须   file   

转自: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

OCI

OCCI

JDBC

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

OCCI

JDBC

JDBC Supplement*

Additional(附加的) support for XA, Internationalization, and RowSet operations under JDBC

JDBC

SQL*Plus*

Additional libraries and executable(可执行的) for running SQL*Plus with Instant Client

SQL*Plus 10.2

SQL*Plus 11.2

ODBC Supplement*

Additional(附加的) libraries for enabling ODBC applications with Instant Client (Not all platforms)

ODBC

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的安装和使用

标签:ora   nbsp   log   head   connect   tcl   sample   必须   file   

原文地址:https://www.cnblogs.com/YuyuanNo1/p/9099702.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!