一、本人以前都是使用oracle10g客户端,PLSQL连接oracle12c时报错
确认配置完全没问题,纠结了不少时间。后来查的是oracle客户端太老了,版本11.2.0.2.0以上即可
二、下载客户端
客户端下载地址
https://www.oracle.com/database/technologies/instant-client/microsoft-windows-32-downloads.html
本人下载版本11.2.0.4.0instantclient-basic-nt-11.2.0.4.0.zip
三、配置客户端
解压客户端,将instantclient_11_2放在C:oracleproduct12.2.0路径
在instantclient_11_2目录下新建networkADMIN,新建tnsnames.ora配置如下:
ORCLCDB202 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.202)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCLPDB202 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.202)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orclpdb)
)
)
配置环境变量,PATH中添加C:oracleproduct12.2.0instantclient_11_2
新增NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK,解决中文乱码问题
四、PLSQL配置
打开PLSQL跳过连接进到主界面,Tools->Preferences->Options,配置如下
C:oracleproduct12.2.0instantclient_11_2
C:oracleproduct12.2.0instantclient_11_2oci.dll
配置保存退出
五、重新打开PLSQL连接
出现Connect as选择框基本OK了,输入账号密码登录即可。