Jul 29, 2015

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

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

I have received a call from junior DBA that while I am connecting to newly installed database software and connecting as "/ as sysdba", above error is comming.

The Error:

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 29 14:30:36 2015

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

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


Enter user-name:

...
Solution:
This is a very small and simple issue.The error message ORA-12162 "TNS:net service name is incorrectly specified", is very misleading.

It suggests that there is a problem with the tnsnames.ora file contents, but in reality the message ORA-12162 "TNS:net service name is incorrectly specified" results from improperly setting your ORACLE_SID value.

To fix this error in Windows, set your $ORACLE_HOME:

c:> set ORACLE_SID=PROD

In Linux, these commands sets ORACLE_HOME and $ORACLE_SID as follows:

export ORACLE_HOME=/u01/app/product/11.2.0/dbhome_1;

export ORACLE_SID=PROD;
export PATH=$ORACLE_HOME/bin:$PATH

I am sure now no issue will come.




2 comments:

Translate >>