1

我认为通过 Oracle.ManagedDataAccess.Core NuGet 包使用 ODP.Net Managed Connections 的全部意义在于您不需要在运行时环境中安装 Oracle 客户端。我发现很多关于

ORA-12154: TNS: 无法解析指定的连接标识符错误

错误,但所有关于潜在修复的讨论都围绕客户端配置问题展开。

我所做的正是本文中所描述的。当我从 Visual Studio 本地运行该应用程序时,该应用程序连接良好,但是当它由 Azure 管道构建和部署时,它无法连接。来自服务器的连接不是问题,并且没有 tnsnames.ora 和 sqlnet.ora 文件,或者 TNS_ADMIN 和 ORA_HOME 环境变量。

2021-02-15T18:04:40.867284043Z       Oracle connection string: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip address>)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=<sid>)));User Id=<User>;Password=<Password>;
2021-02-15T18:04:40.871226968Z [41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
2021-02-15T18:04:40.871246768Z       Connection id "0HM6HRG9F3OUG", Request id "0HM6HRG9F3OUG:00000004": An unhandled exception was thrown by the application.
2021-02-15T18:04:40.871252068Z       Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12154: TNS:could not resolve the connect identifier specified
2021-02-15T18:04:40.871255568Z        ---> OracleInternal.Network.NetworkException (0x00002F7A): ORA-12154: TNS:could not resolve the connect identifier specified

我也尝试了这个 EZ Connect 字符串,但没有成功:

<user>/<password>@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=<ip address>)(Port=<port>))(CONNECT_DATA=(SID=<mysid>)))

我错过了什么?

更新:该问题似乎是由 Azure 混合连接管理器而不是 Oracle 连接的潜在问题引起的。现在查看 VPN 连接。暂时保留您尝试不同连接字符串格式的建议。

4

2 回答 2

1

我们会看到输出中的内容,但需要查看您在调用应用程序中实际指定连接字符串的方式。ora-12154 是最常见的连接问题之一,在整个 Internet 上都有相关报道。当你用谷歌搜索它时,你发现了什么?

它说您指定了一个无法在客户端的 tnsnames.ora 文件中找到的 tns 连接字符串。由于我不知道您客户的 tnsnames 的内容,也不知道您实际指定了什么,所以我现在不能多说。

但是,如前所述,几乎每个 Oracle 博客和 Internet 上的在线资源都写有此错误。我最喜欢的是:https ://edstevensdba.wordpress.com/2018/09/19/troubleshooting-ora-12154/

还 。. . oracle:cdb$ oerr ora 12154 12154, 00000, "TNS:could not resolve the connect identifier specified" // *Cause: A connection to a database or other service was requested using // a connect identifier, and the connect identifier specified could not // be resolved into a connect descriptor using one of the naming methods // configured. For example, if the type of connect identifier used was a // net service name then the net service name could not be found in a // naming method repository, or the repository could not be // located or reached. // *Action: // - If you are using local naming (TNSNAMES.ORA file): // - Make sure that "TNSNAMES" is listed as one of the values of the // NAMES.DIRECTORY_PATH parameter in the Oracle Net profile // (SQLNET.ORA) // - Verify that a TNSNAMES.ORA file exists and is in the proper // directory and is accessible. // - Check that the net service name used as the connect identifier // exists in the TNSNAMES.ORA file. // - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA // file. Look for unmatched parentheses or stray characters. Errors // in a TNSNAMES.ORA file may make it unusable. // - If you are using directory naming: // - Verify that "LDAP" is listed as one of the values of the // NAMES.DIRETORY_PATH parameter in the Oracle Net profile // (SQLNET.ORA). // - Verify that the LDAP directory server is up and that it is // accessible. // - Verify that the net service name or database name used as the // connect identifier is configured in the directory. // - Verify that the default context being used is correct by // specifying a fully qualified net service name or a full LDAP DN // as the connect identifier // - If you are using easy connect naming: // - Verify that "EZCONNECT" is listed as one of the values of the // NAMES.DIRETORY_PATH parameter in the Oracle Net profile // (SQLNET.ORA). // - Make sure the host, port and service name specified // are correct. // - Try enclosing the connect identifier in quote marks. // // See the Oracle Net Services Administrators Guide or the Oracle // operating system specific guide for more information on naming.

于 2021-02-15T18:39:44.990 回答
0

此错误是由应用服务与我们客户的本地旧版 Oracle 数据库之间配置不正确的 Azure 混合连接引起的。错误消息的“无法解决”部分实际上是准确的,表明存在潜在的 DNS 错误。

于 2021-04-16T13:45:27.107 回答