ORA-12154 TNS不能解析指定的标识符
在Win下用pl/sql developer访问远程Linux的DB报
ORA-12154 TNS不能解析标示符,但是在Win下SQLPLUS都是正常的
C:\>tnsping lin_hjj
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-FEB-2014 22:56:32
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hjj) (INSTANCE_NAME = hjj)))
OK (60 msec)
C:\>sqlplus sys/oracle@lin_hjj as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Feb 23 22:56:57 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
在网上找了一会儿也没解决,因为遇到的情况都不一样。
突然想到Oracle11g在创建完数据库以后,是不能使用PL/SQL连接的,必须在oracle官网下载instantclient-basic-win32-11.2.0.1.0.zip(注意:与DB版本对应)
解压之后为instantclient_11_2目录,需要做的就是把ORACLE_HOME下的NETWORK/ADMIN拷贝到解压之后的instantclient_11_2目录下。
然后打开PL/SQL DEV-->工具-->首选项-->左侧Oracle-->连接中的ORACLE主目录(instantclient_11_2的全目录,比如D:\instantclient_11_2),OCI库会自动检测的。
之后再进行测试,连接成功。