1

I thought the whole point of using ODP.Net Managed Connections, via Oracle.ManagedDataAccess.Core NuGet package, is that you don't need an Oracle client installed in the runtime environment. I find lots of posts about the

ORA-12154: TNS:could not resolve the connect identifier specified error

error but all discussions about potential fixes evolve around client configuration issues.

I doing exactly what is described in this article. The app connects fine when I run it locally from Visual Studio but when it is built and deployed by an Azure pipeline it cannot connect. Connectivity from the server is not the issue, and there are no tnsnames.ora and sqlnet.ora files, or TNS_ADMIN and ORA_HOME environment variables.

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

I tried this EZ Connect string as well, with no success:

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

What am I missing?

Update: The issue seems to be caused by an underlying issue with the Azure Hybrid Connection manager and not the Oracle connection. Looking into a VPN connection now. Hold your suggestions for trying different connection string formats for now.

1
  • Use Data Source=(DESCRIPTION=(ADDRESS_LIST=... in connection string. Commented Feb 15, 2021 at 20:46

2 Answers 2

1

We see what is in the output, but need to see how you actually specified the connect string in the calling application. ora-12154 is one of the most common connection issues and is written about all over the internet. What did you discover when you googled it?

It says that you specified a tns connect string that could not be located in the client's tnsnames.ora file. Since I don't know the contents of your client's tnsnames, and I don't know what you actually specified, I can't say more at this point.

However, as noted, this error is written about in just about every oracle blog and online resource on the internet. My favorite is here: https://edstevensdba.wordpress.com/2018/09/19/troubleshooting-ora-12154/

Also . . . 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.

5
  • What I am saying in my question is: there is no TNSNAMES.ORA. I am connecting using managed connections, without a TNSNAMES.ORA. The (redacted) connection string is in the log snippet and it does not reference a TNS name.
    – cdonner
    Commented Feb 15, 2021 at 19:35
  • Also, I matched the connection string to the one suggested by Branko in his answer to this question but have tried a number of variations that all did not work, either.
    – cdonner
    Commented Feb 15, 2021 at 19:46
  • your EZ Connect syntax is all wrong. See oracle.com/technetwork/database/enterprise-edition/…. If your db server is running *nix, enter this command : 'oerr ora 12154'. It will describe more exotic problems. I'd post the output in my answer, but can't seem to get it to format for easy reading. And the fact that your EZConnect is so wrong suggests to me that your spec in your app is also wrong, forcing oracle to think it is looking for a tnsnames entry.
    – EdStevens
    Commented Feb 15, 2021 at 21:05
  • I Figured out the formatting issue and have updated my answer with some more suggestions.
    – EdStevens
    Commented Feb 15, 2021 at 21:13
  • Thank you, Ed. We have narrowed this down to an issue with the Azure Hybrid Connection. The Oracle host name is not resolved by DNS on the client at the moment. Why this is happening is unclear, but it does not appear to be an issue with the Oracle connection.
    – cdonner
    Commented Feb 17, 2021 at 14:01
0

This error was caused by an incorrectly configured Azure Hybrid Connection between the app service and our client's on-prem legacy Oracle database. The "could not resolve" part of the error message is actually spot-on and indicates an underlying DNS error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.