Solved

ORA-12505: TNS:listener could not resolve SID given in connect descriptor

Posted on 2001-08-17
6
26,735 Views
Last Modified: 2011-08-18
I encountered a problem with connecting to the Oracle databse. Here is the description of the problem.
Backgroud : I am using Win2K advance server and Oracle 8i Server. To avoid version conflict, i installed my Oracle 8i Server in OraHome01 and Oracle Enterprise Manager in OraHome02. By using 2 different oracle homes in the registry and 2 different physical path, i solve the conflict. Then, i did the following setting in the registry.
Oralce NLS_LANG
    ORACLE - SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    ID0(OraHome81) - NA
    ID1(OraHome80 if available) - American_America.WE8ISO8859P1 (have to, otherwise
cannot start the service, why?)
    Home0(OraHome81) - SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    Home1(OraHome80 if available) - SIMPLIFIED CHINESE_CHINA.ZHS16GBK

I got the following above error message when trying to connect to the db using Oracle Enterprise Manager's SQLPlus which NLS setting default to American. ("ORA-12505: TNS:listener could not resolve SID given in connect descriptor") This problem is solved temporarily when i reconfigured the database using the Oracle8i's database configuration assistant. But once i restart my computer, the problem resume. I totally cannot connect to the database using Oracle 8i's SQLPlus and got the error message as "ORA-12514: TNS: *****(funny funny characters)****, *** SERVICE_NAME")
A little bit of the background when i did the Oracle 8i's installation. The machine that i did the installation is a new machine and hasn't got any network installation during the 8i installation. The Wireless LAN installation only done after the 8i's installation.
Can anybody help me to resolve the problem?
Thanks.
0
Comment
Question by:Janelau
6 Comments
 

Expert Comment

by:hani430
ID: 6395998
Have you tested the connect to the database on Net8? Perhaps there is a wrong sid written in the tnsnames.ora
Does the listener listen to your database? Control the path of the used listener.ora with lsnrctl status. In both of your oracle-homes there is one, but only one is used.
Have you testet changing the oracle-home?
0
 
LVL 47

Accepted Solution

by:
schwertner earned 100 total points
ID: 6396142
This is a generic advise I constructed for a year answering to this kind of questions.
About connection between Personal Oracle and Forms 6 look at
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:447620106871

You can use the "Oracle Net 8 assistant", "Oracle Net 8 Easy config" to see if you have the appropriate entry to the server in the local tnsnames.ora file (find it!). I mean that one in the Client or Forms&Reports home, not that one in the Oracle_Home.
Under local I mean the file tnsnames.ora  in your application, not at the Oracle Server - this is a common mistake.

You have to have there an entry like:

REKS816.RILA.us =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = bigbluenew.rila.us)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = REKS816)
     )
  )


Be aware that in old versions of Oracle instead of SERVICE_NAME you have to use SID. So (SERVICE_NAME = REKS816)will be (SID = REKS816)
     
It is a bad practice, but you can add such entry using simple text editor. But before that make a copy of tnsnames.ora in order to restore it if you do not succeed.

After that go to "control panel" and run "services".
Look at your Oracle_Home_TNSlistener80 process. Stop it! Start it again!

If you work on Unix find the relevant processes and notions of the Unix OS.

On NT server: The listener has a corresponding 'service' running. To be able to connect from the network, the service had to be configured to "Log on as: This account ......." and the account had to have administrator privileges on the network.

If your database is version 8.1.7 on Windows 2000, it is a bug for autostart in services. Check if you can start the database manually i.e. using DBA Studio or Server Manager. The available patch for the file "orannts8.dll" is at:
ftp://oracle-ftp.oracle.com/server/patchsets/wgt_tech/server/windowsNT/network/net8/81701/
Download, stop services, copy the new file, and restart services. It should work.



Two common areas of misconfiguration are responsible for these log-in errors:

(1) Erroneous entries in the TNSNAMES.ORA file, and  
(2) An erroneous default domain setting in the SQLNET.ORA file

A successful client log-in requires that:

1. The database is running.
2. The listener on the host machine is running and is configured correctly.
3. The network is correctly routing TCP/IP packets.
4. The client machine has TCP/IP installed correctly.
5. The client machine has SQL*Net installed correctly.
6. The TNSNAMES.ORA entry for that connection has the correct information.
7. The SQLNET.ORA file is configured correctly.

This solution covers common SQL*Net misconfiguration issues on the client side, and assumes that all
other necessary aspects of the connection are correctly configured and operating properly.

Please refer to the attached files for configuration information.

######################################################

The TNSNAMES.ORA file

The log-in dialog box of the client asks for a connect
string to identify the database in which the client account is located.
The TNSNAMES.ORA file is then searched for this connect string, and the actual  
connect information is found.

Below is a sample TNSNAMES.ORA entry for connecting to a machine named  
"oas.this.com" in DNS. The connection is via TCP/IP to port 1521, and  
the SID of the database containing the server is V732.

oas =  
  (description=  
     (address=(protocol=tcp)(host=oas.this.com)(port=1521))  
     (connect_data=(sid=V732))  
  )  
 
Note: the parentheses are extremely important - omitted or extraneous  
parentheses will result in an invalid entry. On the other hand, white space,
such as tabs, spaces, or newlines, are ignored.

The "host=" entry shown above implies DNS availability; if DNS is not
available, the IP address number may be substituted.


The SQLNET.ORA file:

Before being searched for in the TNSNAMES.ORA file, the connect string  
supplied in the log-in dialog box may be modified if the NAMES.DEFAULT_DOMAIN
variable has a value.

During login, the connect string is parsed to determine whether or not it is
fully-qualified, i.e. that it has full domain information. If it does not, and
the NAMES.DEFAULT_DOMAIN variable is set, then that value is appended to the  
connect string.  

For example, using a connect string "conn" and a NAMES.DEFAULT_DOMAIN  
setting of "oas.this.com" will result in a final connect string of  
"conn.oas.this.com". It is this final value "conn.oas.this.com" that will be  
searched for in the TNSNAMES.ORA file; thus, your entry in the TNSNAMES.ORA
file should start with

conn.oas.this.com =  


Using the TNSPING utility to test connect strings:

To test whether or not a connect string is valid, the utility TNSPING is
provided in the $ORACLE_HOME\bin directory. Run TNSPING with the connect
string you wish to test.  

Example 1:

D:\ORAWIN95\BIN>tnsping test

TNS Ping Utility for 32-bit Windows: Version 2.3.3.0.0 - Production on 02-JUN-
97 18:39:09

Copyright (c) Oracle Corporation 1995.  All rights reserved.

Attempting to contact  
(ADDRESS=(COMMUNITY=tcp.oas.this.com)(PROTOCOL=TCP)(Host=
conn.oas.this.com)(Port=1521))
OK (170 msec)

<end example>


From this result, we see that the connect string "test" resolves correctly to
an entry in the TNSNAMES.ORA file to valid connect information for an Oracle  
database.

On the other hand, the following is a test of an invalid connect string:


Example 2:

D:\ORAWIN95\BIN>tnsping notgood

TNS Ping Utility for 32-bit Windows: Version 2.3.3.0.0 - Production on 04-JUN-
97 09:13:32

Copyright (c) Oracle Corporation 1995.  All rights reserved.

TNS-03505: Failed to resolve name

<end example>

Using TNSPING as a test ensures that your TNSNAMES.ORA entry syntax is
correct, and that there is a listener on the host machine listening for
requests for that port.


~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~     ~~~~~

What follows here are several common problem descriptions & their solutions.


Problem Description:
====================
       You receive an ORA-12162 "TNS:service name is incorrectly
specified" when attempting a Sqlplus (804)/Net8 login with the following
syntax:
       sqlplus <userid>@<alias>
Enter password: <password>

Problem Explanation:
====================
Due to a parsing error with Sqlplus (8.0.4 only) the connect descriptor
is not beeing read properly.

Parsing error does not occur using other utilities, ie. tnsping,
svrmgrl or other versions of Sqlplus.
Using the tnsping utility you are able to resolve the connect string
and verify a listener process is responding.

For example:

[Alpha]> tnsping N804

TNS Ping Utility for Solaris: Version 8.0.4.0.0 - Production on 15-AUG-99 08:03:
04

(c) Copyright 1997 Oracle Corporation.  All rights reserved.

Attempting to contact (ADDRESS=(PROTOCOL=TCP)(Host=Alpha)(Port=1521))
OK (60 msec)



Solution Description:
=====================
Try using a full command line syntax for Sqlplus to avoid this parsing
problem.  For example, at the command prompt use the following syntax:

         sqlplus system/manager@N804

Versus the previous syntax where you were prompted for the password:

       sqlplus system@N804
Enter password: manager    <password is not visible when using this syntax>


If you are able to connect with using the full line syntax, you are
running into Base Bug:611696 for Sqlplus Version 8.0.4.  This bug is fixed in Sqlplus
release 8.0.5, and serveral backports are available, depending on you platform.


Problem Description
-------------------

TNSPING works fine but connecting via SQL*PLUS fails with an ORA-12545. Normally this indicates some

syntax issue with the TNSNAMES.ORA which is not the cause.

Turn on client tracing in the sqlnet.ora file TRACE_CLIENT_LEVEL = 16

nscall: connecting...
nsc2addr: entry
nttbnd2addr: entry
nttbnd2addr: port resolved to 2929
nttbnd2addr: looking up IP addr for host: tcp2.oas.this.com
nttbnd2addr:  *** hostname lookup failure! ***
nttbnd2addr: exit

The problem in this case the tnsnames.ora, sqlnet.ora and hosts file had the following entries that
caused the the
lookup of the IP addr to fail when resolving the address in the host file.

TNSNAMES.ORA
~~~~~~~~~~~~~
HOST = 196.6.122.28 or tcp2

Calling address: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(Host=196.6.122.28)(Port=1521))(ADDRESS=(PROTOCOL=TCP)

SQLNET.ORA
~~~~~~~~~~~
names.default_domain = oas.this.com
name.default_zone = oas.this.com

HOST File (WINNT/system32/hosts)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
196.6.122.28     tcp2.oas.this.com


Solution Description
--------------------

To correct the problem ensure the following:

TNSNAMES.ORA
~~~~~~~~~~~~
HOST = tcp2.oas.this.com

SQLNET.ORA
~~~~~~~~~~
names.default_domain = oas.this.com
name.default_zone = oas.this.com

HOSTS File
~~~~~~~~~~
196.6.122.28     oas.this.com

Explanation
-----------
The Calling address in the tnsnames.ora and host file has a different domain_name then in the sqlnet.ora
thus
causing ORA-12545.


Problem Description
-------------------

The connection is refused. You know that the user exists and the password is
correct and the database is up.

You cannot connect from sql*plus on the client to your database. You get
the following error message;

ORA-12705 Invalid or unknown NLS parameter value specified.

Solution Description
--------------------

Check your NLS_LANG settings.
The value entered is incorrect or there is a typo error.
For example, the NLS_LANG value for the United States English should be:

NLS_LANG = AMERICAN_AMERICA.WE8ISO8859P1
You do the following:

Create domain user accounts on Windows NT using Windows scripting, Enterprise
Administrator, or a third party administration tool.

Problem
=========
Certain users cannot authenticate successfully with any Oracle OLAP client
product, such as Express Spreadsheet Add-in (XSA), Express Admininstrator, or
Express Analyzer (OEA), but can authenticate successfully using the Express
Connection Utility if they do the following:

-  Open the Express Connection Utility.

-  Select Options...Set Domain Identity, and enter the User ID, Domain, and
Password.

-  Select Options...Set Authentication Level, and choose Connect.

-  Select File...Open, choose Connect to remote Express Server 5 or 6, and
enter the following information:

Object UUID:    <Your OES UUID>
Transport:      ncacn_ip_tcp
Host:           <Your host name>

Solution summary
================
In User Manager for Domains, check the Profile for the failing user and make
sure the Home Directory does not have a UNC address specified in the "Local
path:" field.
       
Authentication failure can occur if Oracle Express Server is not able to get a
valid Home Directory.  This can occur if, in the Windows NT User Environment
Profile, Home Directory groupbox, the "Local path:" option is chosen, but a UNC
path is referenced in the field, e.g.:

\\Servername\Sharename.

Only a local path on the machine is valid for this field.

You can check this by doing the following:

-  Login to the Domain Controller as an Administrator.

-  Run the User Manager for Domains utility in the Administrative Tools.

-  Double-click on a failing user to open the User Properties dialog box.

-  Click on the Profile button.

If the "Local path:" option is selected in the Home Directory groupbox,  a UNC
path such as \\Servername\Sharename is not valid.

Normally, if you select the "Local path:" option and try to enter a UNC path,
you will get an error message as follows:

\\Servername\Sharename is an invalid path name.  Please enter a valid path name.

If you are using Windows scripting or an administration tool such as Enterprise
Administrator to create user accouts, it may be possible to create a user
profile with an invalid UNC path in the "Local path:" field.
         
0
 

Expert Comment

by:ankhan100599
ID: 6396263
Do a search for tnsnames.ora file. Could be that when you installed into two separate homes, there are 2 tnsnames.ora files on your computer in different oracle homes. So when you are creating your new connection using sql*net or whatever, it is writing to the wrong tnsnames.ora file.

So a search might return you 2 tnsnames.ora files. Make a backup copy of both these files. Open both of them and search for the connection name you have given. It should be in one and not the other. Copy the complete connection details to the one that doesnt have it. Save and try connecting to your db again. Make sure the oracle services are running.

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.

 

Expert Comment

by:wandidj1
ID: 6398051
Other issues about NLS_LANG,

If the database is set up using a specified NLS_LANG, you can get the result if you specify Oracle Session with that NLS_LANG.
In case you're not possible to define NLS_LANG on your registry, you can define it on either environment variable or from sqlplus session using alter session command.

example:
# setenv NLS_LANG SIMPLIFIED CHINESE_CHINA.ZHS16GBK
or from sqlplus,
alter session set nls_language Chinese.

There is other issue you should learn regarding combination of NLS_LANG, NLS_TERRITORY, and others NLS_..., there is a rule to overide between them



Thanks

Wandi



0
 

Author Comment

by:Janelau
ID: 6408695
wandi,

This is a useful hints for the NLS settings. Thanks.


Jane
0
 

Author Comment

by:Janelau
ID: 6408703
schwertner,

Thanks for your answer. It is not a straight forward answer but it helps to give hints to solve this particular as well as other Oracle problems.


Jane
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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  â€¦
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to take different types of Oracle backups using RMAN.

759 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

17 Experts available now in Live!

Get 1:1 Help Now