想在本地通过PL/SQL连接服务器的oracle,又不想安装庞大的oracle,这是方法
-
下载instantclient-basic-nt-11.2.0.3.0包,这里下的是11.2.0.3.0版本
-
新建oracle_client文件夹,将instantclient-basic-nt-11.2.0.3.0解压缩至此(如d:/oracle_client)
-
在d:/oracle_client目录下新建Sqlnet.ora文件,内容如下:
# This file is actually generated by netca. But if customers choose to # install "Software Only", this file wont exist and without the native # authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES = (NTS)
Tnsnames.ora文件,内容如下:
# tnsnames.ora Network Configuration File: d:\oracle_client \tnsnames.ora # Generated by Oracle configuration tools.
UCRC_FWQ = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.5)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ucrc) ) )
变量名:TNS_ADMIN
值:d:/oracle_client
若不设置会报ORA-12154: TNS:could not resolve the connect identifier specified错误。如果之前安装Oracle 又卸载了,会遗留NLS_LANG=NA的键值。打开注册表项HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE。在右面找到NLS_LANG=NA并删除掉,否则会报ORA-12705: Cannot access NLS data files or invalid 错误。
工具——选项——连接——Oracle主目录名
设置为d:/oracle_client
Oci库设置为d:/oracle_client/oci.dll