Solved

ORA-12154: TNS:could not resolve service name

Posted on 2006-06-13
14
2,466 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
Comment Utility
Do you more than one Oracle Home, such as Developer suite and client?
0
 
LVL 23

Accepted Solution

by:
paquicuba earned 350 total points
Comment Utility
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
Comment Utility
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
 
LVL 23

Expert Comment

by:paquicuba
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 23

Expert Comment

by:paquicuba
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I've de-installed and reinstalled again

the problem is finally solved...

thanks for everyone's effort!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now