Home » RDBMS Server » Networking and Gateways » cannot connect using oracle net_service
cannot connect using oracle net_service [message #142866] Tue, 18 October 2005 01:37 Go to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

hi,

I have a Solaris 9 box hosting Oracle 9i . I created a tnsnames.ora file manually.
Now the problem is that when i can connect to oracle without specifying net_service name but when i try to connect with the net_service name it generates error -- ORA-12154: TNS:could not resolve service name.

Quote:


dogmatix:SID=testdb=>sqlplus scott/tiger@srvc_testdb

SQL*Plus: Release 9.2.0.1.0 - Production on Tue Oct 18 02:25:23 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve service name


Enter user-name: scott/tiger

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL>




But the service name exist in the tnsnames.ora file

tnsnames.ora file
SRVC_TESTDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dogmatix)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = testdb)
    )
  )


sqlnet.ora file

# SQLNET.ORA Network Configuration File: /data1/u01/app/oracle/product/9.2.0/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

SQLNET.AUTHENTICATION_SERVICES=(NONE)

NAMES.DIRECTORY_PATH=(TNSNAMES, ONAMES, HOSTNAME)


and now see when i use tnsping

Quote:


dogmatix:SID=testdb=>tnsping srvc_testdb

TNS Ping Utility for Solaris: Version 9.2.0.1.0 - Production on 18-OCT-2005 02:35:38

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

Used parameter files:
/data1/u01/app/oracle/product/9.2.0/network/admin/sqlnet.ora

TNS-03505: Failed to resolve name

[ /data1/u01/app/oracle/product/9.2.0/network/admin ]
dogmatix:SID=testdb=>



but when i try by specifying address
Quote:


ogmatix:SID=testdb=>tnsping '(ADDRESS=(PROTOCOL=tcp)(HOST=dogmatix)(PORT=1521))'

TNS Ping Utility for Solaris: Version 9.2.0.1.0 - Production on 18-OCT-2005 02:36:52

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

Attempting to contact (ADDRESS=(PROTOCOL=tcp)(HOST=dogmatix)(PORT=1521))
OK (10 msec)



Note : I am trying to connect from the same machine which is hosting Oracle so no network connectivity issue i suppose.

regards & thanks,
tarun
Re: cannot connect using oracle net_service [message #142893 is a reply to message #142866] Tue, 18 October 2005 04:57 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
Hi,

03505, 00000, "Failed to resolve name"
// *Cause:  The service name you provided could not be found in TNSNAMES.ORA,
//          an Oracle Names server, or a native naming service.
// *Action: Verify that you entered the service name correctly.  You may need
//          to ensure that the name was entered correctly into the network
//          configuration.


Try adding this to your SQLNET.ORA file:
NAMES.DEFAULT_DOMAIN =  world


... and change your TNSNAMES.ORA entry to:
SRVC_TESTDB.world =


Best regards.

Frank
Re: cannot connect using oracle net_service [message #142896 is a reply to message #142893] Tue, 18 October 2005 05:13 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member
Frank, Thanks for the reply but the problem still persist.

I changed as u mentioned ,

sqlnet.ora
 
SQLNET.AUTHENTICATION_SERVICES=(NONE)
NAMES.DEFAULT_DOMAIN=world
NAMES.DIRECTORY_PATH=(TNSNAMES, ONAMES, HOSTNAME)
 


tnsnames.ora
SRVC_TESTDB.world =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dogmatix)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = testdb)
    )
  )


and now see this

Quote:


testdb=>sqlplus "sys/tarun as sysdba"

SQL*Plus: Release 9.2.0.1.0 - Production on Tue Oct 18 06:06:31 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.

SQL> exit
Disconnected



but not with net_service
Quote:


testdb=>sqlplus "sys/tarun@srvc_testdb.world as sysdba"

SQL*Plus: Release 9.2.0.1.0 - Production on Tue Oct 18 06:07:03 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve service name


Enter user-name:



Quote:


testdb=>tnsping srvc_testdb.world

TNS Ping Utility for Solaris: Version 9.2.0.1.0 - Production on 18-OCT-2005 06:05:52

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

Used parameter files:
/data1/u01/app/oracle/product/9.2.0/network/admin/sqlnet.ora

TNS-03505: Failed to resolve name



any other idea .

[Updated on: Tue, 18 October 2005 05:13]

Report message to a moderator

Re: cannot connect using oracle net_service [message #142902 is a reply to message #142896] Tue, 18 October 2005 05:36 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
Hi,

The easiest would be to enable tracing in your SQLNET.ORA file. Studying the trace output should indicate why the entry is not recognized.

Best regards.

Frank
Re: cannot connect using oracle net_service [message #142905 is a reply to message #142902] Tue, 18 October 2005 05:43 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

Thanks for the reply Frank,

but can you tell me how to enable tracing for SQLNET.ORA or any link to read.

By Tracing, do u mean OS tracing?
Re: cannot connect using oracle net_service [message #142907 is a reply to message #142905] Tue, 18 October 2005 05:48 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
To trace TNSPING traffic, add the following to your SQLNET.ORA file:

TNSPING.TRACE_LEVEL = 16
TNSPING.TRACE_DIRECTORY = /tmp/sqlnet/


Best regards.

Frank
Re: cannot connect using oracle net_service [message #142920 is a reply to message #142907] Tue, 18 October 2005 07:31 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

Hi Frank,

First of all thanks for your support . And now i am able to resolve the issue. I am explaining the problem .

The parameter TNS_ADMIN was set on my machine and it was pointing to a non-default location. And i was creating the tnsnames.ora file at the default location i.e. $ORACLE_HOME/network/admin but Oracle was reading from the location specified by TNS_ADMIN environment variable .

I removed it and now everything working fine.

Thanks for your help.

tarun
Re: cannot connect using oracle net_service [message #263131 is a reply to message #142920] Wed, 29 August 2007 02:56 Go to previous messageGo to next message
rajatsuvra
Messages: 1
Registered: August 2007
Junior Member
hi tarun

can u pls tell me where I will find the TNS_ADMIN variable.

rajat
Re: cannot connect using oracle net_service [message #263133 is a reply to message #263131] Wed, 29 August 2007 03:04 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
env | grep TNS_ADMIN

Regards
Michel
Re: cannot connect using oracle net_service [message #263312 is a reply to message #263133] Wed, 29 August 2007 12:27 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
Quote:
you can set it
export TNS_ADMIN=$ORACLE_HOME/network/admin

Re: cannot connect using oracle net_service [message #264556 is a reply to message #263133] Mon, 03 September 2007 13:59 Go to previous messageGo to next message
shill68
Messages: 1
Registered: September 2007
Junior Member
Hi Michel,

can you please explain were i can set the TNS_ADMIN variable. I'm new with Oracle and can't find thees Variable.

Regards

Stefan

Ok i have it

[Updated on: Mon, 03 September 2007 14:21]

Report message to a moderator

Re: cannot connect using oracle net_service [message #264789 is a reply to message #263312] Tue, 04 September 2007 10:36 Go to previous message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
DreamzZ wrote on Wed, 29 August 2007 11:27
Quote:
you can set it
export TNS_ADMIN=$ORACLE_HOME/network/admin



Previous Topic: ORA-20000: Oracle Text error:DRG-10599: column is not indexed
Next Topic: distributed database
Goto Forum:
  


Current Time: Mon Nov 25 19:43:35 CST 2024