Solved

ORA-12154: TNS:could not resolve the connect identifier specified

Posted on 2008-10-20
6
3,280 Views
Last Modified: 2012-05-05
I have a 2005 MS Vision Studio and would like to retrieve some data from an Oracle table that is on an Oracle 9i database schema, but  I have Oracle 10G on my machine.  When I run the VB code, I get "ORA-12154: TNS:could not resolve the connect identifier specified" error.  How do I resolve this issue?

This is the part of the VB code:

myConnection_GLOBAL = New OleDbConnection("Provider=msdaora;Data Source=frd01;User Id=xxx;Password=xxx;")
            mySqlDataAdapter_GLOBAL = New OleDbDataAdapter("SELECT BAN, BTN, NAME from TABLE", myConnection_GLOBAL)

This is what I have in my SQLNET.ORA file:
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com
NAME.DEFAULT_ZONE = chq.aci.ameritech.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)

This is what I have in my TNSNAMES.ORA file:
FRD01 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = our server hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = frd01)
    )
  )
0
Comment
Question by:scpig
6 Comments
 

Accepted Solution

by:
denverskier earned 100 total points
ID: 22762809
My first test here would be to run tnsping from a command window to ensure that you have your sqlnet set up correctly.
> tnsping frd01

If it does not come back as OK, you will need to make sure that everything in the tnsnames.ora is correct and that the tnsnames.ora file resides in the correct directory.  If all of that is still not working, you may want to try to ping the "HOST = our server hostname" server IP.

If those both come back positive, let us know.  If not, then check to make sure that the IP and the SID are correct.

Good luck.
0
 
LVL 47

Assisted Solution

by:schwertner
schwertner earned 50 total points
ID: 22765040
SQLNET.AUTHENTICATION_SERVICES= (NTS)
should be commented.

Try to see if the service is registered by the listener:

% lsnrctl services

You do not mention the version but by Oracle 10g/11g the first thing your DBA
should do is to amke static registration:

Go to the remote 10g installation where the Oracle server resides.

Backup LISTENER.ORA file!!!!!!!

In ...\network\admin open listener.ora

see

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\Ora10g)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = test)
      (ORACLE_HOME = D:\Ora10g)
    )
  )

Add the entry
    (SID_DESC =
      (SID_NAME = test)
      (ORACLE_HOME = D:\Ora10g)
    )
with regard to the particular Oracle Home and SID Name.

Restart the listener:
c:>lsnrctl stop
c:>lsnctl start
0
 
LVL 7

Assisted Solution

by:vishal68
vishal68 earned 100 total points
ID: 22765380
The culprit is NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com line in sqlnet.ora. This line means that Oracle will automatically add chq.aci.ameritech.com to the connect string provided by you. i.e in your case when you say Data Source=frd01, Oracle will actually look for a tnsnames.ora entry named frd01.chq.aci.ameritech.com and not a simple frd01.

Solution
either comment NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com in sqlnet.ora
or
change your tnsnames.ora entry to

FRD01.chq.aci.ameritech.com =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = our server hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = frd01)
    )
  )

HTH
Vishal
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:scpig
ID: 22767645
tnsping frd01 comes back positive.
And I also commented out NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com in sqlnet.ora
but I still get the same ORA- error.
I do not have listener.ora file in my C drive.
What else could be wrong?

0
 

Assisted Solution

by:denverskier
denverskier earned 100 total points
ID: 22767811
since you can successfully tnsping the database, ensure that you can connect from a command prompt using:

>sqlplus username/password@frd01

if that works, then you can rest assured that Oracle is working properly, and you likely have something wrong in your code (sorry, I'm not a VB person).

If not, then log into the server where the database resides and follow schwertners advice from above and try again.
0
 
LVL 7

Assisted Solution

by:vishal68
vishal68 earned 100 total points
ID: 22773825
Another thing to check would be, are there multiple tnsnames.ora on your system. Search for tnsnames.ora on your client system. If there are multiple tnsnames.ora then ensure that you have made the entries in all of them.

HTH
Vishal
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

705 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

13 Experts available now in Live!

Get 1:1 Help Now