Share |

ORA-12154: TNS:could not resolve service name

If you are on Windows 64-bit, check out following solution: 64-bit Windows and Oracle 10.2 connection problem

The database you are trying to connect to, is not known by your Oracle client.

Typically, every Oracle Home installed on your pc wil have a subdirectory called network\admin or net80\admin (Oracle 8.0 client).

This subdirectory should contain a file sqlnet.ora which contains following line:
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME)
Possible other values are ONAMES, OID, ...

In case of Oracle Instant client or if someone has changed the default location where sqlnet.ora and tnsnames.ora resides, you will have to look for the alternative path which is identified by the TNS_ADMIN variable.

This can either be a registry variable (set on HKEY_LOCAL_MACHINE\software\oracle), an environment variable (see your .profile on Unix or choose Properties, Advanced, Environment Variables of My Computer on Windows) or stored in some batch script.

Default installations will use a TNSNAMES.ora file to resolve database names.
See if the tnsnames.ora file exists in your sub directory.

If it doesn't exist and NAMES.DIRECTORY_PATH only contains TNSNAMES (and optionally HOSTNAME), there will be no name resolving.

You will need to create a tnsnames.ora file which will contain all databases you want to connect to.

A typical entry looks like this:
ORA102.WORLD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = databasename)
    )
  )
Replace hostname and databasename and possible the portnumber to reflect your Oracle databases.

If you think both sqlnet.ora and tnsnames.ora are correct, you might be using multiple Oracle Homes.

Typically this is the case if you install Oracle Developer suite after you install a database on your pc.

With Oracle Locator Express you can easily switch between multiple Oracle Homes.

If you are using other resolving technologies such as Oracle names or Oracle Internet Directory, you can add the service to it (ONAMES, OID). Make sure the servers are accessible.

Also check for following value in sqlnet.ora:
NAMES.DEFAULT_DOMAIN = eu.dbmotive.com
When this value is present in you sqlnet.ora file, it will automatically be appended to the entries in your tnsnames.ora file when searching for an entry.
In following example we are going to search for the example1 entry.
Our NAMES.DEFAULT_DOMAIN is set to eu.dbmotive.com, and following is the entry in tnsnames.ora:
EXAMPLE1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = EXAMPLE1)
    )
  )
Now, we are going to tnsping it:
C:\>tnsping example1
TNS-03505: Failed to resolve name
The entry is not found, but it is in our tnsnames.ora
This is because the default domain .eu.dbmotive.com is appended to the tnsnames entries.

You have 2 options. Either add the .eu.dbmotive.com domain to the tnsnames entry, or add an extra dot (.) to the tnsping command:
C:\>tnsping example1.
If you are using Oracle Easy Connect, for example within you php application, and your Oracle connection fails with this ORA-12154 error, you might need to change the value of NAMES.DIRECTORY_PATH in you sqlnet.ora file:
sqlplus system/password@//localhost:1521/DBM001

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
vi sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES)
Add the entry for Oracle Easy Connect and retry.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Also pay attention to the TWO_TASK variable.
 Related Oracle Errors  ORA-06413: Connection not open.
 Was this information helpful?  Yes No
If it was not helpful, please take some time to explain why. This is not to ask questions, you can do so in the forum.

Welcome to our forum for Oracle error: ORA-12154 Add your own message



i have a program connecting to oracle server using VC++. i got this 2 error

Driver's SQLSetConnectAttr failed State:IM006,Native:0,Origin:[Microsoft][ODBC Driver Manager]
ORA-12154: TNS:could not resolve service name State:08004,Native:12154,Origin:[Oracle][ODBC][Ora]

But using a simple program that i created using VC++ also, i can connect to the oracle.. i also tnsping.. so whats the problem?.. Can anyone help me to solve this problem?

Thanx!
 
Can it be that the variable holding the connect identified is too small and that the value is truncated?

 
what do u mean by variable holding the connect identified is too small?
and why the value is truncated?

can't u explain more about this..
this problem still occurred... i don't know what to do to solve this problem...
 
We are using ORACLE 9i database for primavera software. it is a project management software.
to upgrade this software from primavera 5 to primavera 5 service pack 3 we also require to
change the database schema or upgrade the database. while upgrading database i got the error
mentioned in the title. I checked out tnsname.ora file but it didnot work.
plz give me any solution to solve this problem.
 
I installed a oracle client in my system. after installation when i tried to login it is throwing error as 'TNS:could not resolve service name'. I have checked the tnsname.ora there is no clue. how to proceed very urgent. Whether any installation path or anything to be changed.
 
dir sear
ihave problem
1setuped orcale10g and devolper6i in my device
but the database not connection my form please ihope to your slove my problem
my form gived (( can not reslove server tns))
thank
 
We are using ORACLE 9i database, I already used oracle forms and reports, but now the database is not connecting. It shows the same error that"ORA-12154:TNS could not resolve the service name". I have tried various methods mentioned in verious sites, but no use.
 
Forms, especially < iDeveloper Suite 9 has a different Oracle home.

You have to make sure the tnsnames entry is know to this Oracle home.

Search for all the tnsnames.ora in your Operating system and check if the service name is available to all the tnsnames.ora

 
err
ORA-12154: TNS:could not resolve service name
and
ORA-06413 with manager console
but sqlplus is ok on the connection with my db
Oracle 9 is not certified to run on Windows Vista 64bit.

There are a number of problems reported, like a different path for the "Programs Files" subdirectory.

What you can do is to enable client side sqlnet tracing in order to determine the error code returned by the SQLNET network stack.

Have a look at your sqlnet.ora to enable sqlnet client tracing

I guess I have the same problem. My client is uses SO VISTA, running a PowerBuilder application and the TNSNAMES.ORA and SQLNET.ORA are in a shared network disk (W:\oracle). I have the key TNS_ADMIN set to W:\oracle. When using sqlplus its ok, but Powerbuilder issues me 'ORA-12154: TNS:could not resolve service name'. Can someone help me?

 
I get this msg when ever i try to login from command promt using sqlplus also tried
sqlplus scott/tiger@orcl (my service name).However it is connecting fine from sqldevelper using both basic & tnsname login.It is successfully connecting from oracle 9i net configuration assistant
and net manager.
This is my tnsnames.ora entry:
DB.SKYTECHSOLUTIONS.INTRA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.1.100)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
Do you connect using DB.SKYTECHSOLUTIONS.INTRA, or just using DB?

If the latter, what is the value of SQLNET.DEFAULT_DOMAIN in your sqlnet.ora file?

 
Dear Sir,
I have installed the Oracle 9i Enterprise Edition in windows 2003 server PC(192.168.0.1)and its working. Then I have installed Developer 2000 in another client machine(192.168.0.3). NOw I want to connect databse from the client. For this I have changed the tnsnames.ora file in client as follows.

file.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.0.1)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = ORCL)
)
and saved . However I am unable to connect with database. I need help to solve this problem Desperately waiting for solution.
Since you installed developer, your default home will be the home developer is installed in.
You are probably changing the tnsnames.ora in the Oracle home of your database software.

Either change the tnsnames.ora in your developer home, or change the default home using our free tool "Oracle Locator Express"

Hi ,

Can you please give me the steps to install Oracle client 9i2 on window 2003. I', following otn doc http://www.oracle.com/technology/software/products/oracle9i/index.html, but I guess it is not working .

I will greatly appreciate your help
Thanks much
Puja
 
hi, i get this error when i tried to do a connection in SSIS package, i need connect to a oracle database that is located in another server, i install the oracle client 10g and the configure that and i dont have problem to add the service name, but, when i want to create a connection in SSIS i get this error, i have installed the version of 32 and 64 bits of the oracle client by recomendations of few of people, but , i dont have positive results. basically, i need to get data from oracle database(server 1) and put into a sql server database(server 2).

thx and regards.
luis salgado
mexico
 
I have to connect to the database SPPRVP2.eadv.na.jnj.com using TOAD.But while connecting I am receiving the error saying TNS could not resolve the service.I don't have the TNS file for the databse mentioned here.Can you provide the database for the same.
Please help me for resolving this issue....
We cannot provide tnsnames info for companies.

You have to contact your local helpdesk or Oracle team in order to obtain this information
 
i am trying to login in isqlplus but when ever i tried to log in iam getting a error msg stating TNS:COULD NOT RESOLVER SERVICE NAME.i tried using scott,tiger,orcl. plz help me to solve this problem
 
I have PL/SQL developer configured in my system(Win XP). I can work with all Oracle instances using the same. Even I can connect to Oracle using Oracle client SQL+. But while connecting through Command prompt (c:\>sqlplus user/password@hoststring ) there is an error message "ORA-12154 : TNS could not resolve the service name " .

I think my TNSNAMES.ora file is a correct one. Any suggession regarding this ?
 
i experience this above error on d production db, when client connection gets to its limit, its stops d dbservices. when trying to connect back it gives protocol adapter error ORA-12560. TEMPORARY solution is to set oracle_sid to dbname or restart d services, before client can connect to the database. the db version 10gR1 on a 2003server environment on HPProliant server740 with 8gb of RAM.

after possible ways to resolve this by restarting d db manually i also ran into this problem ORA-27102 OUT OF memory. i increase the large pool portion of the SGA and d PGA. check the server mode which was on shared mode with 5 user maximum connection.checked d RAM %used which was about 4gb for the whole server including d OS. though some other users are configured n dedicated mode

pls how can i put an end to manually restating the database every 4-6 times daily.
and hw do i solve the memory issues.

solutions to these problems will highly be appreciated

 
when i tried to shutdown or connect from sqlplus its gives me this error, but when i go back to control panel to restartd service i will be able to connect to d instance and user can connect to d db. pls give some hint on the way farward.

the is really frustrating.
I run oracle database 10gr1 on 2003server, could it be an OS compatibility issues?
 
Dear Madam/Sir,
We had installed the CLIENT several times in Win XP Prof & Win 2003 Server with no problem.
This is teh first time we try it with Vista and we have the above error.
I cannot even make TEST CONNECTION over ODBC Data Source Administrator.
Does anybody tried a similar thing this before?
Thanks in advance...
 
pls provide me the syntax for connection string with primavera and orcale database.
thanx
 
data services not available ,impromptu is unable to provide data access.

error number 4
DMS-E-CONNECTION REJECT ,a connection has been rejected by remote interface during operation 'attach database'.
 
Hi,

I'm trying to connect locally by using the command:
sqlplus system/my_password@dbmain

but I'm getting the ORA-12154 error.

I have a network interface which address is statically set to 192.168.1.10.

The content of my TNSNAMES.ora if as follows:

INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
)
)

DBMAIN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SID = dbmain)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)


The sqlnet.ora is as follows:


TRACE_DIRECTORY_CLIENT = D:\Logs

LOG_FILE_CLIENT = Logfile.log

SQLNET.AUTHENTICATION_SERVICES= (None)

LOG_DIRECTORY_CLIENT = D:\Logs

TRACE_FILE_CLIENT = TraceFile.log

TRACE_LEVEL_CLIENT = ADMIN

LOG_DIRECTORY_SERVER = D:\Logs

#SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (HOSTNAME, TNSNAMES, ONAMES)



and the listener.ora:


LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = dbmain.aimsoft)
(ORACLE_HOME = D:\oracle\ora92)
(SID_NAME = dbmain)
)
)



Please tell me what I'm doing wrong there...
 
Our application consists of 3 services which are windows based. All the three services pick data from database and again insert/update in to a table from the same database. Suddenly one of the services started throwing an Exception ?ORA-12154 could not resolve the identifier?. Those services use the same connection string but only one service started throwing the above mentioned exception. In the other hand we checked the connect identifier and also checked for any network related issues exist. But everything seems to be perfect. We suspect that the OS in the system in which the services was installed got corrupted as the system got abruptly shutdown many times because of power shutdown. We know that UPS can be used to save the system from power shutdown but we want to know the reason why one particular service started throwing this exception.
Kindly get back to us as soon as possible regarding this issue.
 
I get the following error sometimes in my web application.

Microsoft OLE DB Provider for Oracle error '80004005'
ORA-12154: TNS:could not resolve service name

however it works fine at other times. not sure whats causing the problem and why its happening.
 
i installed oracle 9i and developer 6i.installation is successful without errors.but when i tried to connect form with database then an error message is displayed"TNS could not resolve the service name",although i created a service and tested it.but why is this problem and how to solve it.
You need to make sure you have selected the correct Oracle home.
Use Oracle locator express to switch to you database home if necessary
 
I have installed Oracle 9i on Windows Server 2003 Standard X64 edition. Oracle installed succesffuly but the database not created and giving error.TNS permssion denied.
delete the sqlnet.ora file it will solve your problem. To be sure firt rename it if workes delete it
 
We are using ORACLE 9i database, I already used oracle forms and reports, but now the database is not connecting. It shows the same error that"ORA-12154:TNS could not resolve the service name". I have tried various methods mentioned in verious sites, but no use.
You need to check the sqlnet.ora and tnsnames.ora of your current ORACLE_HOME to see if they contain the correct information
 

Hi,

I was login as sys user in oracle9i and create a ordnery new user, Then shutdown the database and going to sql+ promt, and try to login created user name and password,connection not esstablished. It shows TNS: protocol adepter error, then I was try to login as scott user agian it throws same error. so I was think, My database services not start,then I had restart my database, again shows same error.

plz give solution for my problem. I as waiting for ur reply. Try to reply me soon..

Regards,

K.saravanakumar.

 

i am using oracle 9i r1 on windows server 2003 r2 x64. i get error ora-12154 could not resolve service name...

Any solution plz.

thx

jah

Make sure the Oracle client is not installed in a directory containing ().

By default on 64-bit, it is installed in c:\program files (X86)

The round brackets can not be handled by the Oracle client, and it will result in the ORA-12154 error.

Either use the latest Oracle client (11.2) or install in a different directory.
There is no patch for your version, if you are on 9i r2 you can download Patch 4928723 (9.2.0.7.0 Patch 6)

You can check Oracle Support note 334528.1: "ORA-12154 or ORA-6413 Running 32-bit Oracle Software on 64-bit Windows OS" for more information

 

 

Hello
I'm using Oracle 11g client on windows 7 64 bit (Oracle 9i client is not working on this OS).
The server is still Oracle 9i DB.

The win application I'm developing is unable to connect to the DB and indeed when I try to perform tnsping I recieve the error: TNS-03505 Failed to resolve name (However I can connect to the DB on the server using the SQL Developer).

This is my sqlnet.ora:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

This is my tnsnames.ora:
OPER =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 14.1.0.89)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = DB2OD)
   )
 )

Does anybody knows what should I do in order to enable connecting to DB on the server, Is it possible at all to connect from oracle 11g client to an Oracle 9i server?

 

 

 

Do you have an environment variable TNS_ADMIN set which point to a different location?

Are you able to tnsping oper. ? So with an extra dot at the end?

 

Hi

I don't have an environment variable TNS_ADMIN (I searched the registery without any results, if it could be somewhere else let me know).

However, when I reached the folder where the tnsnames.ora file actually exists (C:\app\Administrator\product\11.2.0\client_1\network\admin in my case which I assume is the default) the TNSPING did work.
Despite that my application still could not connect to the DB giving me the following error:
ora-12154 tns could not resolve the connect identifier specified.

I must make it clear that from an XP OS with Oracle 9i client installed the application did connect to the DB without any problems so the problem is probably not in the application itself.

Any ideas?


You can also define TNS_ADMIN as an (SYSTEM) environment variable.
Press Windows-key + Break (Which opens System Properties), goto Advanced tab page and click environment variables (Check both User and System variables).

If tnsping does work when you are in the correct folder, but not when you are somewhere else, it might indicate that it is set.

Did you check if you find more than 1 sqlnet.ora or tnsnames.ora on your filesystem?

Also, is your application running under the same privileges as the dos box where you do the tnsping? 




Thanks for your reply, it helped me find what the problem was: when I searched for other  sqlnet.ora or tnsnames.ora files in my system I found out that the tnsnames.ora existed only in the administrator user (The Oracle 11g client was firstly installed by our sysadmin in the administrator user) and didn't exist for my user, after I copied the file to my user the TNSPING worked properly from all the folders and my application was able to connect to DB without any problems.

 
DBMotive - Need your help!

 

I'm trying to create repository in informatica 8.6.1 and its throwing this error.

Failed to logon to Database server Database driver error... Function Name : Logon ORA-12154: TNS:could not resolve the connect identifier specified Database driver error... Function Name : Connect Database Error: Failed to connect to database using user [PRADEEP_REP] and connection string [XE].

PRADEEP_REP is the username in Oracle 10g

XE is the service name.

I'm able to tnsping successfully (TNSPING XE) from command prompt. Also I dont have any TNSADMIN system variable. With the same login I can enter into database.

Apreciate your help.
 

i have oracle 0i in my system.during installing oracle 9i i have cancelled the net configuration setup.Now i cannot connect to oracle through scott.

Please send me the solution and also see to it that the solution should provide the requirement of .ora files in my system.

You need to start network configuration assistance and create the appropriate listener.

 

 

Iam using 10g db in AIX. My application is OFSA.

We  recently change IPaddress in the AIX server from 10.20.3.1 network to 10.20.5.10.

So we try to change the ipadd in the tns,sqlnet,listner files in the server itself. But all the files hold host as Name  rather than ip address. So there is no need to key in the files.

But i have changed the required files in the client from the old ipaddress to new ipaddress. Now i am able to login to OFSA modules. But i am not able to run any process which throws internal error. I have a lookup of  all log files which shows error ORA:12154

pls help us to resolve the situation.

thanks

robin

 

 

 

Did you restart the listener and database after you have changed the ip address?

 

MOMcnn.Open "Provider=oraOLEDB.Oracle;Data Source=isshp01_work5;User Id=AMIUSER;Password=PASSWORD;"

 

Hi,

I am having two applications one is using 9iclient and another is using 10g express edition if 10g is installed 10g is working not 9i i want both the applications to work.

Plzzzzzzzzzzz help me

Thebest option would be to set the TNS_ADMIN variable and point to the correct tnsnames.ora file

 

Hello!

I would like some help.

I use an ODBC connection for an oracle 10 DB.

When I do a test connection with ODBC manager, the connection is successful.

I use a software whitch use this same DB and a ODCB manager connection (intergrate at this soft) but in this soft the test connection result is "[ODBC Driver Manager] Only SQL_DRIVER_NOPROMPT is allowed when connection pooling is enabled".

Do you have some idea?

thanks a lot for your help.

PS: i have done a TNSPING and the result is :

TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 03-SEP-2010 14:12:26

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

Used parameter files:
D:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = srv21dtc.dtc.actaris.com)(PORT = 1521))) (
CONNECT_DATA = (SERVICE_NAME = TEAMSBM)))
OK (50 msec)

This is a known issue (i.e. a bug) in some drivers, you will need to upgrade the Oracle client (to 10.2.0.4 or 11g)

I can't the oracle client is integarte at the software.

I have not an acces at the source

I have found the problem, my oracle server is in 64 bit an my client is in 32 bit.

So for working correctly the both will be in 32 bit

Thanks for ypour help ! :)

Add your message

 Please provide your personal info 



 Please ask your message as briefly and clear as possible 

 Spam Protection 
Validation Code: 63ph8umavd25yn27e


Ask Your Question

If you need more information about this particular error message, you can leave a forum message.

We are replying to this message whenever we have some spare time, so please do not consider this as a private 'solve my critical issue asap' service.

Should you need professional Oracle Assistance to make your project a success, please have a look at our consultancy services.


Spam Protection

In order to prevent automatic generation of messages, we are asking for a validation code. This code is unique and is generated every time a new message is asked.

If you do not enter the validation correctly, your message will not be recorded.


Forum Rules

Please be polite, do not USE ALL UPPERCASE, no insults, violance or any other threats.