16.3.2 ORA-12154
Indicates that the specified connection alias cannot be resolved.
Message
ORA-12154: Cannot connect to database.
Could not find alias string in string.For example:
ORA-12154: Cannot connect to database.
Could not find alias sales in LDAP.-
When only one (system or local)
tnsnames.orafile is used:ORA-12154: Cannot connect to database. Could not find alias sales in /u01/app/oracle/product/21.3.0/dbhome_1/network/admin/tnsnames.ora. -
When both the system and local
tnsnames.orafiles are used:ORA-12154: Cannot connect to database. Could not find alias sales in path_to_file_1, path_to_file_2.
-
When only one (system or local)
tnsnames.orafile is used:ORA-12154: Cannot connect to database. Could not find alias sales in /u01/app/oracle/product/21.3.0/dbhome_1/network/admin/tnsnames.ora and LDAP. -
When both the system and local
tnsnames.orafiles are used:ORA-12154: Cannot connect to database. Could not find alias sales in path_to_file_1, path_to_file_2 and LDAP.
Cause
A connection to the database or other service is requested using a connection alias, but the specified alias cannot be resolved into a connect descriptor using one of the configured naming methods. For example, if you have used a network service name as the connect identifier, then the network service name cannot be found in a naming method repository or the repository cannot be located.
By default, the client tries all naming methods in an order: starting with local (TNSNAMES), followed by LDAP, and then Easy Connect Plus. A failure to resolve an alias through all of these naming methods returns in an error.
Action
-
Check for mistakes in the specified connection string.
-
If your
sqlnet.orafile contains theNAMES.DIRECTORY_PATHparameter, then ensure that the parameter contains valid values. -
If you are using an alias from the
tnsnames.orafile, then perform these steps:-
Verify that the
tnsnames.orafile exists, is in the correct directory, and is accessible. You can find thetnsnames.orafile in any of the following locations:-
The directory specified by the
TNS_ADMINenvironment variable, if it is set. -
The
ORACLE_BASE_HOME/network/admindirectory. If the file is not present in theORACLE_BASE_HOME/network/admindirectory, then look for the file inORACLE_HOME/network/admindirectory.
-
-
Ensure that the alias, given in the connect string, exists in one of the
tnsnames.orafiles.This network service name should match the name in the
tnsnames.orafile exactly if the name is simple and there is notNAMES_DEFAULT_DOMAINin thesqlnet.orafile, or the network service name is a fully-qualified name. If the network service name in the connect string is simple, then check theNAMES_DEFAULT_DOMAINparameter in thesqlnet.orafile. Its value is appended to the network service name given in the connect string. This fully-qualified name should be the entry in thetnsnames.orafile. -
Ensure that there are no syntax errors anywhere in the
tnsnames.orafiles. Look for unmatched parentheses or stray characters. Ensure that magic quotes are not used. -
If you are connecting from a Login dialog box, then verify that you are not placing an at sign (
@) before the connect network service name. Activate client tracing, and repeat the operation.
-
-
If you are using LDAP directory naming, then perform these steps:
-
Verify that the net service name or database name used as the connect identifier is configured in the directory.
-
Verify that the LDAP directory server is up and accessible.
-
Verify that the default context used is correct by specifying a fully-qualified net service name or a full LDAP DN as the connect identifier.
-
Verify that the
ldap.orafile exists and is in the correct location. The following directories are searched for theldap.orafile in an order:-
The directory specified by the
TNS_ADMINenvironment variable. -
The
ORACLE_BASE_HOME/network/admindirectory. If the file is not present in theORACLE_BASE_HOME/network/admindirectory, then the file is searched in theORACLE_HOME/network/admindirectory. -
The directory specified by the
LDAP_ADMINenvironment variable. -
The
ORACLE_BASE_HOME/network/admindirectory for a read-only Oracle home. -
The
ORACLE_HOME/network/admindirectory for a read/write Oracle home.
-
-
Verify that the parameters defined in the
ldap.orafile are correct, as follows:-
The
DIRECTORY_SERVERSparameter defines the correct host and port for one or more valid LDAP servers. -
The
DEFAULT_ADMIN_CONTEXTparameter defines the location of the Oracle Context in this directory that should include the network service entry.
If the
ldap.orafile does not exist, then these parameters are resolved using automatic discovery. -
-
Verify that the LDAP server host and port are defined in DNS.
-
Verify that the directory has the default Oracle Context defined.
-
Use the
ldapsearchutility or a directory administration tool to verify that the network service object exists in the Oracle Context at the location given by the value of theDEFAULT_ADMIN_CONTEXTparameter.
-