Tuesday 18 July 2017

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

Cause: The connect descriptor corresponding to the net service name in 
TNSNAMES.ORA or 
in the directory server (Oracle Internet Directory) is incorrectly specified.
Action: If using local naming make sure there are no syntax errors in the
 corresponding connect
descriptor in the TNSNAMES.ORA file. If using directory naming check the 
information 
provided through the administration used for directory naming.

Example:
oracle@hostname:~$ sqlplus scott
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 26 15:34:14 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified

Solution:
Windows:
set ORACLE_SID=PROD
Linux:
Set oracle home if not set, you can check it by “echo $ORACLE_HOME”
oracle@hostname:~$ export ORACLE_HOME=/opt/oracle/product/ora12r2
oracle@hostname:~$ export ORACLE_SID=PROD
oracle@hostname:~$ sqlplus scott
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 26 15:39:22 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning and Automatic Storage Management options
SQL>

No comments:

Post a Comment