1.下载Oracle Client Package .
从http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html下载
Instant Client Package – Basic包( 标注:All files required to run OCI, OCCI, and JDBC-OCI applications)这里下载的是Version 11.1.0.7
2.本地保存Oracle Client Package:
创建文件夹,比如oracle_client,将下载的文件加压缩到此文件夹里.(笔者目录: D:\oracle_client\instantclient_10_2)
3.在当前目录下,新建立两个文件,sqlnet.ora和tnsnames.ora然后再手动配置sqlnet.ora和tnsnames.ora
比如这里是:
sqlnet.ora文件内容:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsnames.ora文件内容(斜体表示需要替换的内容):
orcl=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
4.配置环境变量
变量名: TNS_ADMIN
变量值: D:\oracle_client\instantclient_10_2
否则出现:ORA-12154: TNS:could not resolve the connect identifier specified错误
如果之前安装了Oracle 又卸载,会遗留NLS_LANG=NA的键值.输入RegEdit打开注册表HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE.在右面找到NLS_LANG=NA并删除掉
否则会报ORA-12705: Cannot access NLS data files or invalid 错误.
5.安装pl/sql软件(过程略)
6.配置pl/sql的Oracle连接参数:
选择pl/sql的工具/首选项(too/ preference/)里的连接,在右面设置Oracle主目录名(即安装目录)和OCI库.
Oracle主目录名: D:\oracle_client\instantclient_10_2
OCI库: D:\oracle_client\instantclient_10_2\oci.dll
7.登陆pl/sql测试成功