oracle报错ora-12162,【故障处理】ORA-12162 错误的处理

【故障处理】ORA-12162: TNS:net service name is incorrectly specified

一.1场景

今天拿到一个新的环境,可是执行sqlplus / as sysdba的时候不能登录,报ORA-12162: TNS:net service name is incorrectly specified的错误,之前没有碰到过,就随时记录下,备查。

一.2实验还原

Last unsuccessful login: Thu Mar 19 16:59:06 BEIST 2015 on /dev/pts/0 from 200.31.177.54

Last login: Thu Jul 16 22:44:20 BEIST 2015 on ftp from ::ffff:200.31.156.201

*******************************************************************************

*                                                                             *

*                                                                             *

*Welcome to AIX Version 5.3!*

*                                                                             *

*                                                                             *

*  Please see the README file in /usr/lpp/bos for information pertinent to    *

*  this release of the AIX Operating System.                                  *

*                                                                             *

*                                                                             *

*******************************************************************************

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>ps -ef|grep ora_pmon_

oracle  348182       1   0   Apr 25      -  7:42 ora_pmon_DATAWDB

oracle  630842       1   0   Apr 25      - 20:02 ora_pmon_COGDB

oracle  843948       1   0   Apr 25      -  6:45 ora_pmon_ETLDB

oracle 5005418 4427974   0 09:44:03  pts/0  0:00 grep ora_pmon_

oracle@SJCk4:/home/oracle>ORACLE_SID=DATAWDB

oracle@SJCk4:/home/oracle>echo $ORACLE_SID

DATAWDB

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 17 09:56:44 2015

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

ERROR:

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

Enter user-name:

ERROR:

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

Enter user-name:

ERROR:

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

SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

oracle@SJCk4:/home/oracle>echo $ORACLE_HOME

/app/oracle/product/10.2.0/db_1

oracle@SJCk4:/home/oracle>echo $ORACLE_SID

DATAWDB

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>

oracle@SJCk4:/home/oracle>export ORACLE_SID=DATAWDB

oracle@SJCk4:/home/oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 17 09:59:27 2015

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

SQL>

SQL>

一.3总结

[oracle@rhel6_lhr ~]$ 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@rhel6_lhr ~]$

可以确定的是ORA-12162是由于ORACLE_SID未设置或者设置不正确导致的,推荐使用export ORACLE_SID=XXX来设置,当不能设置的时候再用ORACLE_SID=XXX来直接设置。

一.4About Me

...........................................................................................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

QQ:642808185 若加QQ请注明你所正在读的文章标题

创作时间地点:2015-07-17 10:00~ 2015-07-17 19:00 于外汇交易中心

...........................................................................................................................................................................................

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值