当我尝试运行此
时#sqlplus system@orcl
它给了我这个错误
SQL*Plus: Release 10.1.0.3.0 - Production on Tue Apr 20 02:24:41 2010
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
oracle服务器正在运行,我可以通过SQLDeveloper连接
我的.profile看起来像这样
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Setting PATH for Python 3.1
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}"
DYLD_LIBRARY_PATH=/Users/lesce/instantclient
export TNS_ADMIN=/Users/lesce/instantclient
export ORACLE_SID="orcl"
export DYLD_LIBRARY_PATH
export PATH=$PATH:/Users/lesce/instantclient
的tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
的listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
我的SqlDeveloper配置
username : sys
role : sysdba
connection type : basic
hostname : localhost
port : 1521
sid : orcl
答案 0 :(得分:0)
在ORCL之前删除tnsnames.ora中的无关空间(为清晰起见显示为下划线):
_____ ORCL =
应该是
ORCL =
SQLDeveloper在“基本”模式下不使用tnsnames.ora,因此不受影响。