ORA-12154: TNS:could not resolve service name error occurs when the connect identifier used to connect to a database or other database service could not be resolved into a connect descriptor using one of the naming methods configured. This issue might be caused by a number of factors, which makes it difficult to address. Users may need to test more than one approach before finding the underlying cause of the ORA-12154: TNS:could not resolve service name.

If the issue is occurring on multiple PCs after attempting to connect to the network, the target database server may have gone down for a short period of time. Connection problems might potentially be at cause, or the destination name could differ from the input address. This error ORA-12154: TNS:could not resolve service name indicates that the Oracle client was unable to connect to the listener on the requested database server.



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



Solution 1

There could be error in connect identifier. Revisit the parameters in the connect identifier. If any configuration is misspelled, correct it. The connect identifier should be as per the connect descriptor in the database. Check the following parameters.

host name / ip :
port number.   :
service name /sid :
username.      :
password.      :


Solution 2

Check the oracle database is running. The database may be shutdown temporarily or maintenance is going on. Check with the database administrator about the health of the database. If you are using the database installed locally, you can run the below command to check the database status

sudo service oracle status

sudo service lcnrctl status


Solution 3

Check the network connectivity between the oracle client and the oracle database server. If any network issue or IP address or host name change will cause the issue. The DHCP configuration might reroute the connection. If any network issue occurs, fix the network issue. This will resolve the error.



Solution 4

If you are using local naming files, do the following actions

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


Solution 5

If you are using LDAP naming configurations, do the following actions

  • 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


Solution 6

If you are using the easy connect naming configurations, do. the. following action

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



Leave a Reply