下载下来的instantclient-basic-nt-11.2.0.4.0.zip文件解压缩D:\Program Files\instantclient_11_2(可以选择自己的目录)

(1) 增加TNS_ADMIN环境变量

TNS_ADMIN=D:\Program Files\instantclient_11_2

(2) 把TNS_ADMIN加入到Path变量

(3) 把tnsnames.ora文件放到TNS_ADMIN目录(D:\Program Files\instantclient_11_2)中。

tnsnames.ora

将instantclient解压到磁盘,然后手工增加系统环境变量
path=C:\instantclient-basic-nt-11.2.0.2.0
ORACLE_HOME=C:\instantclient-basic-nt-11.2.0.2.0
TNS_ADMIN=C:\instantclient-basic-nt-11.2.0.2.0
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

# tnsnames.ora Network Configuration File: F:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl2)
)
)

在plsql首选项中,配置配置oracle主目录为:

E:\Java\instantclient_11_2

E:\Java\instantclient_11_2\oci.dll

重启plsql

05-11 15:23