?
Solved

ORA-12154: TNS:could not resolve service name

Posted on 2006-06-13
14
Medium Priority
?
2,531 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
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 1400 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 200 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 200 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 200 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] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

850 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