ORA-12162: TNS:net service name is incorrectly specified (单实例与RAC下处理方式基本一致)
ORA-12162: TNS:net service name is incorrectly specified (单实例与RAC下处理方式基本一致)
RAC环境下,本机两个节点登陆均包如下错误:
(1)sysdb登陆 [oracle@db1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:00:13 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. ERROR: ORA-12162: TNS:net service name is incorrectly specified [oracle@db2 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:04:49 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. ERROR: ORA-12162: TNS:net service name is incorrectly specified (2)system用户登陆 [oracle@db1 ~]$ sqlplus system/system SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:05:49 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. ERROR: ORA-12162: TNS:net service name is incorrectly specified [oracle@db2~]$ sqlplus sys/system SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:06:49 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. ERROR: ORA-12162: TNS:net service name is incorrectly specified (3)数据库服务名方式连接 oracle@db1 ~]$ sqlplus sys@db as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:07:49 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- db1 oracle@db2 ~]$ sqlplus sys@db as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:09:49 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> select instance_name from v$instance; INSTANCE_NAME ---------------- db2 查看错误通用表述信息 [oracle@db1 ~]$ oerr ora 12162 12162, 00000, "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. [oracle@db1 ~]$ 故障处理 故障原因:两个节点均未设置 ORACLE_SID未设置 进入oracle系统用户下,两个节点下分别设置 vi .bash_profile 加入ORACLE_SID=db1 ; export ORACLE_SID vi .bash_profile 加入ORACLE_SID=db2 ; export ORACLE_SID 发现登陆正常: [oracle@db1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:22:20 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> oracle@db1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 24 09:22:20 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL>