Oracle Instant Client 配置方法

从Oracle网站下载对应版本的Instant Client,以10.2.0.4为例,包含以下几个部分:

 

instantclient-basic-win32-10.2.0.4.zip
instantclient-jdbc-win32-10.2.0.4.zip
instantclient-odbc-win32-10.2.0.4.zip
instantclient-sdk-win32-10.2.0.4.zip
instantclient-sqlplus-win32-10.2.0.4.zip 

其中instantclient-basic-win32-10.2.0.4.zip是必须的。

 

方法一:

 

1.解压到D:/instantclient_10_2

2.将D:/instantclient_10_2增加到PATH环境变量中 

3.增加以下环境变量:

TNS_ADMIN=D:/instantclient_10_2

NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK (*)

ORACLE_HOME=D:/instantclient_10_2 (*)

(*):可选

4.编辑tnsnames.ora设置本地NET服务名


使用sqlplus进行测试:

sqlplus 用户名/密码@本地NET服务名

 


方法二:

1.解压至D:/instantclient_10_2/BIN中,并建立D:/instantclient_10_2/NETWORK/ADMIN目录

2.编辑注册表ORA.REG文件:

===============================

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE]

"inst_loc"="C://Program Files//Oracle//Inventory"

 

[HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_OraClient10g_home1]

"ORACLE_HOME"="D://instantclient_10_2"

"ORACLE_HOME_NAME"="OraClient10g_home1"

"ORACLE_GROUP_NAME"="Oracle - OraClient10g_home1"

"ORACLE_BUNDLE_NAME"="Enterprise"

"NLS_LANG"="TRADITIONAL CHINESE_TAIWAN.ZHT16MSWIN950"

"ORACLE_HOME_KEY"="SOFTWARE//ORACLE//KEY_OraClient10g_home1"

===============================

 

3.双击导入注册表

4.编辑oracle.key文件,添加一行SOFTWARE/ORACLE/KEY_OraClient10g_home1,对应于ORA.REG中的键。

5.添加D:/instantclient_10_2/BIN到PATH环境变量中 

6.添加sqlnet.ora文件到D:/instantclient_10_2/NETWORK/ADMIN中,包含如下两行:

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

7.添加tnsnames.ora文件到D:/instantclient_10_2/NETWORK/ADMIN中


tnsnames.ora范例: 

EXTPROC_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

    (CONNECT_DATA =

      (SID = PLSExtProc)

      (PRESENTATION = RO)

    )

  )


MYORA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = MYDB)

    )

  )

你可能感兴趣的:(Database)