现象: root@dbserver/# su - oracle $ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 10:26:14 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR: ORA-12162: TNS:net service name is incorrectly specified
Enter user-name: ^C $ $ sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 10:26:25 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> conn / as sysdba ERROR: ORA-12162: TNS:net service name is incorrectly specified
SQL>
原因: 因为没有声明ORACLE_SID导致的,声明之后就没问题了。
解决方案:
$ export ORACLE_SID=ORCL $ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 10:28:57 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options