I'm running oracle XE on Vista business. I can connect to the database
fine using SQL Plus and even SQL Developer
After installing XE, I installed the Oracle tools for .NET from here
(http://www.oracle.com/technology/software/tech/windows/odpnet/
index.html)
There are no other oracle products installed on my machine.
I initially noticed the problem when I couldn't see my local database
from within Visual Studio, Further investigation lead me to TNSPING
which also doesn't work. My guess is that if I can fix the issue with
TNSPING, that all will be well in the world of .NET.
Output from TNSPING shown below:
=========================================================================
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production
on 13-AUG-2008 10:08:32
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
=========================================================================
Contents of the specified SQLNET.ORA file (above), the path in the
comment at the top doesn't exist!:
=========================================================================
# sqlnet.ora Network Configuration File: C:\oracle\product
\10.2.0\client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
#SQLNET.AUTHENTICATION_SERVICES= (NTS)
sqlnet.authentication_services = (NONE)
#NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES)
NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, LDAP)
NAMES.DEFAULT_DOMAIN = world
SQLNET.EXPIRE_TIME = 0
NAME.DEFAULT_ZONE = world
=========================================================================
TNSNAMES.ORA (slightly modified to preserve anonymity! - asterix's on
the address line) :
=========================================================================
#ifile='C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN
\tnsnames.ora'
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = LB05568.****.****.****.net)
(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
=========================================================================
The oracle tools for .NET seem to have created a second oracle home
but I can't see a home selector app on my start menu.
I also tried TNSPING XE.WORLD which also doesn't work!
I have tried creating a TNS_ADMIN environment variable (using the set
command) pointing to the directory which contains the above files:
line of output of set command below
=========================================================================
tns_admin = C:\oraclexe\app\oracle\product\10.2.0\server\network\admin
=========================================================================
I'm sure that this worked ok previously, I recently removed the oracle
tools for .NET and reinstalled just to be sure of the version I was
running. The install failed a couple of times before it completed
successfully.
All suggestions greatly appreciated, give me a shout if I've been a
bit vague anywhere.
Much appreciated,
Dave.
Just to be sure, set your ORACLE_HOME environment variable to
C:\oraclexe\app\oracle\product\10.2.0\server before using TNSPING, and start
TNSPING from the ORACLE_HOME\bin directory. If this works, you might have
errors due to the second oracle home directory (path).
It is not likely to be the cause, for it seems the right tnsnames and sqlnet
are found.
On second thought: is your listener running? Run lsnrctl start from a
command line after setting the environment variables as shown above.
Furthermore, the sqlnet.ora you show here is not the right one, (wrong path
at top) but I'm not sure if it is actually in that directory....
Be careful with TNS_ADMIN when you install products; it might mess up things
(always backup your files in the admin directory before installing tools)
Shakespeare
I have set the ORACLE_HOME environment variable in my computer
advanced properties, doing this using the SET command only did it for
the command prompt session I was running at the time and I don't know
how to do the eqivalent of the unix EXPORT command in DOS type OS's.
So now the important environment variables are:
=======================================================================================
Path=C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\app
\D7998\product\11.1.0\client;C:\app\D7998\product\11.1.0\client\bin;C:
\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;c:\Program Files
\Microsoft SQL Server\90\Tools\binn\;C:\Windows
\System32\WindowsPowerShell\v1.0\
ORACLE_HOME=C:\oraclexe\app\oracle\product\10.2.0\server
TNS_ADMIN is no longer set.
=======================================================================================
My assumption is that windows isn't case sensitive!!
so now starting a command prompt in C:\oraclexe\app\oracle\product
\10.2.0\server\BIN I try tnsping again
=======================================================================================
C:\oraclexe\app\oracle\product\10.2.0\server\BIN>tnsping xe
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production
on 13-AUG-2008 11:39:13
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
TNS-03505: Failed to resolve name
=======================================================================================
also tried xe.world with the same result!
Looking at the listener, it appears to be started already, issuing
lsnrctl start gives:
TNS-01106: Listener using listener name LISTENER has already been
started
During all of this, the database is still accessible via SQL Plus on
the same machine. I might try to access it from another machine on the
network, if that fails then it's probably something network related.
I'll keep you all posted.
Any more ideas??
1) Windows is not case sensitive, that's correct
2) Env. variables are valid within the session you run (dos-box), unless you
set the way you did. Win has no 'export' functionality.
What I do see is that your TNSNAMES is not used (or at least, the entry is
not found there). If it was, tnsping would say so:
"Used TNSNAMES adapter to resolve the alias"
This might help: copy the entry for XE in your tnsnames, and make it
xe.world = (etc.....). Just leave the old one in place.
It's probably your default domain in sqlnet.ora that is causing the error.
By using TNSPING XE, tnsping starts looking for xe.world, which isn't there.
TNSPING xe.world won't help either, for it still is not there.
You could also remove the default_domain from sqlnet.ora, but I would opt to
add xe.world to TNSNAMES
Shakespeare
Shorter is to use in your tnsnames.ora:
XE.world,xe = (....)
(no space between xe.world and xe)
Duplicating the TNS entry and suffixing it with .world has done the
trick - for tnsping and visual studio.
I've actually seen this happen before but never got round to getting a
decent explanation of why.
Anyway, you've really got me out of a mess, so many thanks.
All the best,
Dave.