欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

用Instant Client连接Oracle数据库(不用安装)

程序员文章站 2022-05-07 20:58:39
...

 

1. 下载oracle的客户端程序包(50M)
       只需要在 Oracle 下载一个叫 Instant Client 的软件就可以了,这个软件不需要安装,只要解压就可以用了,很方便,就算重装了系统还是可以用的。

下载地址:

http://www.oracle.com/technetwork/indexes/downloads/index.html(下载主页)

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html(Instant  Client)

http://www.oracle.com/technetwork/topics/winsoft-085727.html(32)

http://www.oracle.com/technetwork/topics/winx64soft-089540.html(64)

解压到一个目录中即可,例如D:\instantclient_11_2

 

2. 配置操作系统环境变量
NLS_LANG=AMERICAN_AMERICA.AL32UTF8

TNS_ADMIN=D:\instantclient_11_2

 

3. 配置连接Oracle的配置。拷贝tnsnames.ora文件到目录C:\oracleclient。可以从oracle服务器拷贝一个过来。
内容类似:
# tnsnames.ora Network Configuration File: E:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCLProduct =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prmpatm1.asiapacific.hpqcorp.net)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
ORCL122 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 16.157.133.122)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
4. 安装PLSQL Developer
5. 配置PLSQL Developer(第一次可以不用登录直接进到PLSQL Developer)
Tools --> Preferences--> Connections,
#Oracle Home内容为 D:\instantclient_11_2

OCI library内容为 D:\instantclient_11_2\oci.dll
重新启动PLSQLDeveloper
完毕 

 

GBK的

NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

(SIMPLIFIED CHINESE_CHINA.ZHS16GBK)

 

US7ASCII

NLS_LANG=AMERICAN_AMERICA.US7ASCII