我在我的系统上设置了一个本地Oracle数据库,可以通过SqlDeveloper和Sql * Plus(sqlplus system / mypassword @ ORACLE)连接,但是当我尝试在部署选项中设置ODP.Net connectionstring时一个Visual Studio 2010 CLR项目然后我得到一个ORA-12154:TNS:无法解析指定的连接标识符。
我做的动作:
Visual Studio 2010
档案
构建
我的tnsnames.ora的内容:
# tnsnames.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORACLE)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
我的listener.ora的内容:
# listener.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:c:\app\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost.domain.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = c:\app\oracle
sqlnet.ora的内容:
# sqlnet.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
答案 0 :(得分:0)
回答我自己的问题:在我的listener.ora中用localhost替换myhost.domain.com解决了这个问题