0% found this document useful (0 votes)
171 views2 pages

Topic Oracle Error ORA-12154 TNScould Not Resolve Service

This document describes an Oracle error "ORA-12154: TNS:could not resolve service" when attempting to connect to an Oracle database using an OpenESQL application. The resolution involves verifying the TNS alias in the ODBC configuration, checking that the server is correctly cataloged in the TNSNAMES.ORA file, and using the tnsping utility to test the connection. If issues persist, the TNS listener status should also be checked.

Uploaded by

Palash Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views2 pages

Topic Oracle Error ORA-12154 TNScould Not Resolve Service

This document describes an Oracle error "ORA-12154: TNS:could not resolve service" when attempting to connect to an Oracle database using an OpenESQL application. The resolution involves verifying the TNS alias in the ODBC configuration, checking that the server is correctly cataloged in the TNSNAMES.ORA file, and using the tnsping utility to test the connection. If issues persist, the TNS listener status should also be checked.

Uploaded by

Palash Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Topic:

Oracle error: ORA-12154: TNS:could not resolve service



Description:

Attempting to CONNECT to the Oracle database using an OpenESQL application returns

SQLCODE = -19703
SQLMessage > DB: [Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve service name

Resolution:

Within the ODBC driver configuration -- using the Microsoft ODBC Administrator Utility -- one of the configuration parameters will be
the Oracle Server (TNS) alias. It should be possible to test the ODBC connection from within the ODBC Administrator.

I would expect this to fail with the same error as the COBOL application.

The next thing to check is that the server is "cataloged" correctly. The server connection is typically created using Oracle's Network
Configuration utility, netca. The resultant information gets stored under your Oracle installation directory, in
NETWORK\ADMIN\TNSNAMES.ORA .

Using Oracle's "tnsping" utility, you can verify whether the client and connect to the server. For example, with your TNSNAMES.ORA
looking like this :

TNSALIAS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVERNAME)(PORT = PORTNUMBER))
)
(CONNECT_DATA =
(SERVICE_NAME = SERVICENAME)
)
)

e.g.

ORACLE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myserver)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORACLESID)
)
)

you would invoke

tnsping ORACLE

which should, if the configuration is correct, return something like :

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = myserver)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORACLESID)))
OK (50 msec)

If that fails, then you should verify that :

1. The TNS Alias specified within the ODBC driver configuration is set to the correct name,
2. That within TNSNAMES.ORA, the server name, port number, and SERVICE_NAME parameters are set correctly. You may need to
verify this on the server itself, checking the status of the TNS listener with

lsnrctl status

which should show something like :

STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.1.0.3.0 - Production
Start Date dd-mmm-yyyy
Uptime 10 days 3 hr. 7 min. 14 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\Database\Oracle\ora10\network\admin\listener.ora
Listener Log File C:\Database\Oracle\ora10\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver)(PORT=1521)))
Services Summary...
Service "ORACLESID" has 1 instance(s).
Instance "ORACLESID", status READY, has 1 handler(s) for this service...
The command completed successfully


Reference Knowledgebase Document #21700

You might also like