Solved

ORA-12154: TNS:could not resolve service name

Posted on 2006-06-13
14
2,507 Views
Last Modified: 2008-01-09
Hi All, I am developing an ASP.net 1.1 website

because recently I've reinstalled winxp, so I've to install all application again
I could set up the website and oracle client again
but I have this error --> "ORA-12154: TNS:could not resolve service name " when it connects to DB

I can connect to DB with toad
I have the file tnsname.ora already
I have uncheck and check Read & Execute for Authenticated User for C:\Oracle\Ora92
I have added ASP.net privilege to C:\Oracle\Ora92 already

any ideas for how to fix this?

thanks a lot!!!
0
Comment
Question by:orbulat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 23

Expert Comment

by:paquicuba
ID: 16899088
Do you more than one Oracle Home, such as Developer suite and client?
0
 
LVL 23

Accepted Solution

by:
paquicuba earned 350 total points
ID: 16899096
Do some network connection testing using tnsping:
 
i.e.  to tnsping my PROD database

C:\>tnsping PROD

TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 13-JUN-2
006 21:26:04

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

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


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = Paqui)(P
ORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK (50 msec)                                                                                                                        --<<--------- OK


   
0
 
LVL 10

Author Comment

by:orbulat
ID: 16899134
I've only installed one oracle client, only one oracle home

yes, i've tried tnsping, and able to connect to my DB, but I am not using sqlnet.ora
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:paquicuba
ID: 16899207
Can you post your TNSNames.ora file?

Where did you place it?

Have you by any chance created an TNS_ADMIN key under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE?
0
 
LVL 10

Author Comment

by:orbulat
ID: 16899297
TNSNames.ora is placed
C:\oracle\ora92\network\admin

Have you by any chance created an TNS_ADMIN key under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE? <-- couldn't find this key
0
 
LVL 23

Expert Comment

by:paquicuba
ID: 16899317
That key is often created when you have more than one home to manage and want to place the tnsnames.ora file in a central location, so don't worry about it. Your TNSNAMES.ora is in the right directory.

Under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, can you see ORACLE_SID?  If Yes, is it pointing to your SID?

Do you have more than one database?





0
 
LVL 10

Author Comment

by:orbulat
ID: 16899337
I couldn't find ORACLE_SID under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE

I only have one DB

it's weird that I can connect to the DB with toad, but not with my asp.net website

0
 
LVL 23

Expert Comment

by:paquicuba
ID: 16899349
The key should be under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME<?>    Could be HOME0 or any other alias

>>>it's weird that I can connect to the DB with toad, but not with my asp.net website

Yes it is.

It also could be caused by a firewall. Try disabeling your firewall.

Can you connect to SQL*Plus?
0
 
LVL 10

Author Comment

by:orbulat
ID: 16899417
The key should be under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME<?>    Could be HOME0 or any other alias

oh, i can't find the key "ORACLE_SID" under HOME0
0
 
LVL 10

Author Comment

by:orbulat
ID: 16899449
if using SQLPlus

my steps are like this -->

sqlplus /nolog

connect userid/pwd@myDB
0
 
LVL 16

Assisted Solution

by:MohanKNair
MohanKNair earned 50 total points
ID: 16899875
Are you specifying ORACLE_HOME in the ASP program before connecting using the TNS alias?

Verify that the local ASPNET account has all permissions on ORACLE_HOME folder and also its sub-folders.

Once again verify read permission for C:\oracle\ora92\network\admin\tnsnames.ora and C:\oracle\ora92\network\admin\sqlnet.ora files.

Login as ASPNET account

C:> TYPE C:\oracle\ora92\network\admin\tnsnames.ora

C:> TYPE C:\oracle\ora92\network\admin\sqlnet.ora
0
 
LVL 3

Assisted Solution

by:haidersyed
haidersyed earned 50 total points
ID: 16899928
you can visit

http://www.findabout.net/Technology/IT/oraerror.htm#ORA-12154:%20TNS:could%20not%20resolve%20service%20name 
for all possible TNS errors
or

http://www.findabout.net/Technology/IT/oraerror.htm

thanks

However this could be because of multiple oracle homes, invalid domain name in sqlnet then tns file , inaccessable tnsfile etc.
0
 
LVL 11

Assisted Solution

by:mohammadzahid
mohammadzahid earned 50 total points
ID: 16899937
try adding TNS_ADMIN in your environment and point that variable to directory where tnsnames.ora file is located.

Example:  TNS_ADMIN    C:\oracle\ora92\network\admin\tnsnames.ora

0
 
LVL 10

Author Comment

by:orbulat
ID: 16900714
I've de-installed and reinstalled again

the problem is finally solved...

thanks for everyone's effort!
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question