Search code examples
oracle-databasesqlplus

How should I set up my sqlnet.ora and tnsnames.ora files?


I facing login issue with sqlplus login. when I m logging in using hostname, port and service name, its working fine.

sqlplus <userid>/<password>@<hostname>:<port>/<servicename>

No issues with above command. Its working as expected.

When I m trying to login with connect string,

sqplus <userid>/<password>@<connectstring>

I m getting

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

I know my sqlnet.ora and tnsnames.ora are not correct, but not able to figure out where the issue is.

sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES = (NTS)
NAMES.DEFAULT_DOMAIN = world

Just above two line are there in the file.

tnsnames.ora

MYTNSENTRY=
  (DESCRIPTION =
....

hostname, port and service name defined in tnsnames.ora, just one entry is there. I m executing sqlplus commands on windows platform.

Any pointers regarding this is much appreciated.


Solution

  • You have in your sqlnet.ora this line:

    NAMES.DEFAULT_DOMAIN = world
    

    That means '.world' is going to be appended to your connect string before looking it up in tnsnames. Either remove that line from sqlnet.ora, or append '.world' to the entry name in tnsnames.ora

    mytnsentry.world =
       (description...)