问题:配置Instant Client使用PL/SQL直连Oracle
解决方案:
1)解压缩《instantclient-basic-windows.x**-**.*.*.*.*》文件得到《instantclient_*_*》文件夹,在该文件夹下创建两级文件夹《network\admin》,如《E:\oracle\instantclient_11_2\network\admin》,
在admin文件夹下创建tnsnames.ora文件,文件内容类似如下:
# tnsnames.ora Network Configuration File: E:\oracle\instantclient_11_2\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
2)新建环境变量-系统变量:
TNS_ADMIN=值为上一步骤创建的tnsnames.ora文件路径,如下:
TNS_ADMIN=E:\oracle\instantclient_11_2\network\admin
NLS_LANG=字符类型,如下:
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
3)配置PL/SQL
ORACLE_HOME为instant client解压文件路径
OCI Library为解压文件下oci.dll文件路径
4)退出PL/SQL,重新打开即可登录