[Solved] ORA-12162: TNS:net service name is incorrectly spe

Failure phenomenon

1)Try to log in to the system using the system user, and then you will receive the following error message

[oracle@asdlabdb01 ~]$ sqlplus system/sys

SQL*Plus: Release 10.2.0.3.0 – Production on Sat Aug 27 22:54:02 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:

 

2) Login as sysdba will get the same error message

[oracle@asdlabdb01 ~]$ sqlplus/as sysdba

SQL*Plus: Release 10.2.0.3.0 – Production on Sat Aug 27 22:54:48 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:

 

3) But at this time, if you use the service name method to connect to the database, it is possible to succeed, and this is the weirdness of the phenomenon of the problem.

[oracle@asdlabdb01 ~]$ sqlplus system/sys@ora10g
SQL*Plus: Release 10.2.0.3.0 – Production on Sat Aug 27 22:53:41 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

 

Solution:

The reason behind the bizarre failure is surprisingly basic like that: ORACLE_SID is not specified!

Confirm the system’s current ORACLE_HOME and ORACLE_SID environment variables
[oracle@asdlabdb01 ~]$ echo $ORACLE_HOME
/oracle/app/oracle/product/10.2.0/db_1
[oracle@asdlabdb01 ~]$ echo $ORACLE_SID
[oracle@asdlabdb01 ~]$
As you can see, only the ORACLE_HOME environment variable is set at this point, but ORACLE_SID is empty at this point, which is the real cause of the problem.

Similar Posts: