ORA-12154 TNS不能解析指定的標識符

來源:互聯網
上載者:User

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庫會自動檢測的。
之後再進行測試,串連成功。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.