1

I've been turning google upside down and couldn't find an answer. I can connect to my oracle instance like this:

sqlplus 'myuser@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=msoracle.cnujcn8mkxea.us-east-1.rds.amazonaws.com)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))'

But I can't make it work if I create a TNSNAMES.ORA at /usr/lib/oracle/12.1/client64/network/admin

ORCL=
(DESCRIPTION =
  (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL=TCP)(HOST=msoracle.cnujcn8mkxea.us-east-1.rds.amazonaws.com)(PORT=1521))
  )
  (CONNECT_DATA=
  (SERVICE_NAME=ORCL)  -> I tried SID as well. No luck.
  )
)

I tried to

export ORACLE_SID=ORCL
export PATH=$PATH:$HOME/bin:/usr/lib/oracle/12.1/client64/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/12.1/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin

And nothing. The following message always comes up:

ERROR:
ORA-12162: TNS:net service name is incorrectly specified

EDIT: This is the output of the tests in the comments:

[franklin@ip-10-148-17-253 client64]$ sqlplus myuser@ORCL

SQL*Plus: Release 12.1.0.2.0 Production on Fri Aug 5 10:13:39 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

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


Enter user-name: myuser
Enter password: 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: ^C
1

I could fix the problem. I changed my TNS_NAMES.ORA removing ADDRESS_LIST and leaving like this:

ORCL=
(DESCRIPTION =
  (ADDRESS=(PROTOCOL=TCP)(HOST=msoracle.ccccc.us-east-1.rds.amazonaws.com)(PORT=1521))
  (CONNECT_DATA=
  (SID=ORCL)
  )
)

After I created a new file sqlnet.ora and added this:

NAMES.DIRECTORY_PATH = (TNSNAMES)

I also (just in case), renamed both files to lowercase:

[franklin@ip-10-148-17-253 admin]$ ls -ltr
total 8
-rw-r--r-- 1 root root 151 Aug  5 13:08 tnsnames.ora
-rw-r--r-- 1 root root  34 Aug  5 13:08 sqlnet.ora

So now I can connect just doing this:

sqlplus myuser/mypassword@ORCL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.