instant client 的配置
oracle server developer自带了客户端
解压目录:D:\Toolkit\instantclient_11_2
设置环境变量
Ø 在Path变量中加入:D:\Toolkit\instantclient_11_2
Ø NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
Ø ORACLE_HOME=D:\Toolkit\instantclient_11_2
可以省略变量:
Ø TNS_ADMIN=D:\Toolkit\instantclient_11_2
n 默认目录为%ORACLE_HOME%\network\admin
SQL_PATH=D:\Toolkit\instantclient_11_2
LD_LIBRARY_PATH=D:\Toolkit\instantclient_11_2
tnsnames.ora与sqlnet.ora
一般不需要,但个别软件会认这些文件,碰到了再添加这些文件不迟。
tnsnames.ora示例
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
sqlnet.ora示例
# 这是安装客户端验证配置,在即时客户端上会报“ORA-12638: 身份证明检索失败的解决方法”错误。
#SQLNET.AUTHENTICATION_SERVICES= (NTS)
# 即时客户端的验证配置:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
注册表方式配置
http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092699-zhs.html
在官网下载对应的 Instant Client 包,解到 C:\ 。
运行以下批处理,即可。
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v ORACLE_HOME /t reg_sz /d "C:\instantclient_11_2" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v TNS_ADMIN /t reg_sz /d "C:\instantclient_11_2" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v NLS_LANG /t reg_sz /d "SIMPLIFIED CHINESE_CHINA.ZHS16GBK" /f
REM tnsnames.ora
echo ORALOCAL = >C:\instantclient_11_2\tnsnames.ora
echo (DESCRIPTION = >>C:\instantclient_11_2\tnsnames.ora
echo (ADDRESS_LIST = >>C:\instantclient_11_2\tnsnames.ora
echo (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) >>C:\instantclient_11_2\tnsnames.ora
echo ) >>C:\instantclient_11_2\tnsnames.ora
echo (CONNECT_DATA = >>C:\instantclient_11_2\tnsnames.ora
echo (SERVER = DEDICATED) >>C:\instantclient_11_2\tnsnames.ora
echo (SERVICE_NAME = ORCL) >>C:\instantclient_11_2\tnsnames.ora
echo ) >>C:\instantclient_11_2\tnsnames.ora
echo ) >>C:\instantclient_11_2\tnsnames.ora
系统环境变量:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Environment\
用户环境变量:
HKEY_CURRENT_USER\Environment
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。