?
Solved

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

Posted on 2008-10-20
6
Medium Priority
?
3,287 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
[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
6 Comments
 

Accepted Solution

by:
denverskier earned 400 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 48

Assisted Solution

by:schwertner
schwertner earned 200 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 400 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

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 400 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to take different types of Oracle backups using RMAN.

718 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