【故障处理】ORA-12162: TNS:net service name is incorrectly specified (转)
本文将给大家阐述一个因未设置系统环境变量ORACLE_SID导致ORA-12162错误的案例。希望大家有所思考。
1.获得有关ORA-12162报错信息的通用表述信息
[oracle@asdlabdb01 ~]$ 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.
2.故障现象
本文所要描述的故障与这个通用的问题描述不同,在数据库服务器端使用TNSNAMES.ORA中记录的连接串连接没有问题,但如若未指定连接串,将会报出ORA-12162错误。
1)使用system用户尝试登录系统,此时便会收到报错如下信息
[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)使用sysdba身份登陆会得到同样的错误信息
[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)但此时,如果使用服务名方式连接数据库,是可以成功的,这也是该问题现象的诡异之处。
[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
system@ora10g>
想象一下,你的目标是快速的进入到数据库中进行维护操作,但此时登录都遭遇障碍,会感到非常的别扭。更让人抓狂的是,如果此时使用连接串登录到数据库进行停起操作,结果将会处于更加惨烈境况:数据库将因为无法正常登录导致无法启动数据库。
3.故障原因
诡异的故障背后的原因竟然是那样的基础:ORACLE_SID没有指定!
确认系统当前的ORACLE_HOME和ORACLE_SID环境变量
[oracle@asdlabdb01 ~]$ echo $ORACLE_HOME
/oracle/app/oracle/product/10.2.0/db_1
[oracle@asdlabdb01 ~]$ echo $ORACLE_SID
[oracle@asdlabdb01 ~]$
可见,此时只设置了ORACLE_HOME环境变量,但ORACLE_SID此时为空,这就是该问题的真实原因。
4.故障处理
给出ORACLE_SID,重新尝试登录。
[oracle@asdlabdb01 ~]$ export ORACLE_SID=ora10g
[oracle@asdlabdb01 ~]$ echo $ORACLE_SID
ora10g
[oracle@asdlabdb01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Aug 27 23:27:34 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
sys@ora10g>
OK,此时问题处理完毕。
5.小结
这个案例给我们的启迪是什么?
1)系统默认的错误提示信息有时不具有参考价值。而且,某些情况下这些错误提示还可能给我们带来误导。原因很简单,系统默认的错误提示信息不可能囊括所有故障现象;
2)任何系统级别的设置问题都有可能导致数据库系统出现异常;
3)在遇到故障的时候,我们需要沉着冷静。有些时候可能需要我们Check最原始的信息,切莫想当然。
建议:为了避免出现文章中提到的问题,第一,可以将ORACLE_SID
等环境变量写入到系统profile中,但需要确保系统profile文件内容的有效性;第二,不在profile中进行填写,每次登录数据库服务器时手
工完成数据库环境变量的指定,这种方法虽然增加了键盘的敲击,但它更直观、更有保障。
Good luck.
【故障处理】ORA-12162: TNS:net service name is incorrectly specified (转)的更多相关文章
- 【故障处理】ORA-12162: TNS:net service name is incorrectly specified
本文将给大家阐述一个因未设置系统环境变量ORACLE_SID导致ORA-12162错误的案例.希望大家有所思考. 1.获得有关ORA-12162报错信息的通用表述信息[oracle@asdlabdb0 ...
- ORA-12162: TNS:net service name is incorrectly specified
今天在进行修改oracle_sid环境变量的时候,将相关的环境变量值去掉,从而不能进入sqlplus,报错如下: [oracle@kel ~]$ sqlplus / as sysdba SQL*Plu ...
- Oracle案例05——ORA-12162: TNS:net service name is incorrectly specified
最近在梳理环境,发现环境真的不是一般的复杂,配置不是一般的乱,刚在梳理环境的时候发现一个库通过conn /as sysdba无法连接,具体处理过程如下: 一.错误信息 [oracle@ ~]$ sql ...
- 登录RMAN 报告ORA-12162:TNS:net service name is incorrectly specified错
登录RMAN 报告ORA-12162:TNS:net service name is incorrectly specified错 [oracle@localhost admin]$ date Tue ...
- sqlplus登录提示:ORA-12162:TNS:net service name is incorrectly specified错误
[root@localhost ~]# su - oracle [oracle@localhost ~]$ sqlplus '/as sysdba' SQL*Plus: Release 11.2.0. ...
- plsql 连接oralce数据库,报ora 12557 tns 协议适配器不可加载错误
使用plsql 连接oracle 数据库报ora 12557 错误: 解决方案: 1:首先确保服务中的service以及监听器都开启 2:F:\app\Administrator\product\11 ...
- ORA-12546: TNS: 权限被拒绝(ORA - 12546 TNS: Permission Denied)
这个问题上网一查大都是说权限之类的问题,本人在经过第二次折腾之后发现,其实是自己的Oracle客户端工具在破解过程中被自己用防火墙禁止访问网络了,自己还在另一篇博文里记录过,竟然忘光了,BS一下自己! ...
- 【故障处理】ORA-12162 错误的处理
[故障处理]ORA-12162: TNS:net service name is incorrectly specified 一.1 场景 今天拿到一个新的环境,可是执行sqlplus / as s ...
- ORACLE 数据库管理
[故障处理]ORA-12162: TNS:net service name is incorrectly specified 本文将给大家阐述一个因未设置系统环境变量ORACLE_SID导致ORA-1 ...
随机推荐
- ER-STUDIO 6.5工具使用帮助的中文翻译
转自于:http://yujingwang.blog.sohu.com/63362979.html 1 资料 ER-STUDIO的帮助(英文) 2 内容 2.1 ...
- jq生成目录文件树jQuery Ztree基本用法
转自:http://www.cnblogs.com/linjiqin/p/4547452.html 1.首先在页面上有<ul/>标签 ? 1 <ul id="tree&qu ...
- Laravel环境配置之安装Homestead
laravel requirements: PHP >= 5.5.9 (机器上yum安装的是5.3.3) OpenSSL PHP Extension PDO PHP Extension Mb ...
- jquery.validate.js使用说明——后台添加用户邮箱功能:非空、不能重复、格式正确
重点内容为: jQuery验证控件jquery.validate.js使用说明+中文API[http://www.tuicool.com/articles/iABvI3] 简单教程可以参考[jQue ...
- VC创建预编译文件
Building a simple "hello world" Ogre application can take several seconds on a modern mach ...
- ural 1433. Diamonds
1433. Diamonds Time limit: 1.0 secondMemory limit: 64 MB Sasha is lucky to have a diamond in the for ...
- 素数环问题[XDU1010]
Problem 1010 - 素数环问题 Time Limit: 1000MS Memory Limit: 65536KB Difficulty: Total Submit: 972 Acc ...
- extjs 动态添加item
<html> <p> </p> <head> <title>测试页面</title> <meta http-equiv=& ...
- Codeforces Round #213 (Div. 2) A. Good Number
#include <iostream> #include <vector> using namespace std; int main(){ ; cin >> n ...
- overload和override的区别(转)
overload和override的区别 override(重写) 1.方法名.参数.返回值相同.2.子类方法不能缩小父类方法的访问权限.3.子类方法不能抛出比父类方法更多的异常(但子类方法可以不抛出 ...