Skip to Main Content
  • Questions
  • TNS could not resolve the service name

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question, Mukesh.

Asked: September 25, 2017 - 6:55 am UTC

Last updated: September 25, 2017 - 1:22 pm UTC

Version: Oracle DevSuite 10g

Viewed 1000+ times

You Asked

I have been trying to connect SQL Plus, Report Builder but getting error "TNS could not resolve the service name "

In SQL developer i tried with two connections name it worked ,below is the detail :
Connection name : MyConn
user : system
passs: ******
hostname : 192.*******
port : 1521 and SID : XE

and

Connection name : MyDb
user : system
passs: ******
hostname : localhost
port : 1521 and SID : XE

But when i am trying in SQL plus...its throwing error , Please help ..
Here the TNSNAMES file connection details that I tried :

MyConn =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192********.8 )(PORT = 1521))
)
(CONNECT_DATA =
(SID = XE)
)
)

XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192********.8 )(PORT = 1521))
)
(CONNECT_DATA =
(SID = XE)
)
)

Mydb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = xe)
)
)

and Connor said...

We cannot find the entry in your tnsnames.ora file, eg

C:\oracle\product\grid\bin>tnsping qwe

TNS Ping Utility for 64-bit Windows: Version 12.2.0.1.0 - Production on 25-SEP-2017 21:19:32

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:
C:\oracle\product\12.2.0.1\network\admin\sqlnet.ora

TNS-03505: Failed to resolve name


so double check

a) you are using the right tnsnames.ora
b) you do not have any default domains defined, for example, tnsping mydb.world



Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database