ORA-12162: TNS:net service name is incorrectly specified
今天在进行修改oracle_sid环境变量的时候,将相关的环境变量值去掉,从而不能进入sqlplus,报错如下:
[oracle@kel ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 8 19:19:21 2014 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@kel ~]$ 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.
错误信息里描述的是:指定的连接字符串错误,服务名称出错,从而使用netmgr命令来检查连接字符串的正确性:
[oracle@kel ~]$ netmgr
在这里可以测试连接字符串是否出错,但是在这里我测试是失败的,从而查看1521端口是否启动监听:
[oracle@kel ~]$ netstat -tnlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:37667 0.0.0.0:* LISTEN 5140/ora_d000_orcl
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
从而可以看到1521端口未启动监听,从而查看监听的状态:
[oracle@kel ~]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 08-JUN-2014 19:31:45 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
在这里看到监听是未启动的状态,从而打开数据库监听:
[oracle@kel ~]$ lsnrctl start LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 08-JUN-2014 19:31:49 Copyright (c) 1991, 2005, Oracle. All rights reserved. Starting /home/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Log messages written to /home/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=kel)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 08-JUN-2014 19:31:50
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /home/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=kel)(PORT=1521)))
The listener supports no services
The command completed successfully
再次测试,发现是可以成功连接的,从而利用连接字符串来连接服务器:
[oracle@kel ~]$ sqlplus system/orcl@orcl SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 8 19:34:53 2014 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
发现使用连接字符串是可以连接数据库的,再次使用本地进行连接发现还是不可以的,如下:
[oracle@kel ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 8 19:45:49 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. ERROR:
ORA-12162: TNS:net service name is incorrectly specified
最后查看环境变量ORACLE_SID的值:
[oracle@kel ~]$ echo $ORACLE_SID [oracle@kel ~]$
发现环境变量未设置,从而导致连接出错,将ORACLE_SID设置为数据库实例名称:
[oracle@kel ~]$ export ORACLE_SID=orcl
[oracle@kel ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jun 8 19:48:51 2014 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>
当将环境变量ORACLE_SID的值设置为正确的值的时候,发现已经可以连接。
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@asdlabdb ...
- 【故障处理】ORA-12162: TNS:net service name is incorrectly specified
本文将给大家阐述一个因未设置系统环境变量ORACLE_SID导致ORA-12162错误的案例.希望大家有所思考. 1.获得有关ORA-12162报错信息的通用表述信息[oracle@asdlabdb0 ...
- 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一下自己! ...
- ORACLE 数据库管理
[故障处理]ORA-12162: TNS:net service name is incorrectly specified 本文将给大家阐述一个因未设置系统环境变量ORACLE_SID导致ORA-1 ...
- linux 安装oracle
报错1:报display相关错误su - oracleDISPLAY=redhat64-2:1 --此处为远程会话地址(可以写localhost或IP均可)export DISPLAYcd /home ...
随机推荐
- 【memcache缓存专题(2)】memcache安装与命令行使用
进新公司一个多月了,一直没有时间来更新,后续还是要保持着每日更新的频率 安装 在windows上安装 略(都玩到缓存的程度了,就没必要在windows上捣弄了) 给个参考: http://blog.c ...
- Web 技术人员需知的Web 缓存知识
最近的译文距今已有4年之久,原文有一定的更新.今天踩着前辈们的肩膀,再次把这篇文章翻译整理下.一来让自己对web缓存的理解更深刻些,二来让大家注意力稍稍转移下,不要整天HTML5, 面试题啊叨啊叨的~ ...
- Quartz动态添加、修改和删除定时任务
任务调度开源框架Quartz动态添加.修改和删除定时任务 Quartz 是个开源的作业调度框架,为在 Java 应用程序中进行作业调度提供了简单却强大的机制.Quartz框架包含了调度器监听.作业和触 ...
- C++:静态成员
3.7.1 静态数据成员对象是类的一个实例,每个对象都具有自己的数据成员.例如,学生类张三或李四都具有自己的学号,姓名和平均成绩.在实际使用时,常常还需要一些其他的数据项,比如学生人数.总成绩.平均成 ...
- shell编程基础(4)case 与 function
case case语句不用多说和c++里一样,用作选择,但是linux的case语句在语法上和c++还是有些不同的. ###########This is program test the Case# ...
- Java API —— IO流小结
练习题: 1.复制文本文件 package cn.itcast_01; import java.io.BufferedReader; import java.io.BufferedWriter; im ...
- 29 个 PHP 的 Excel 处理类
下面的 PHP Excel 处理类中,包含 Excel 读写.导入导出等相关的类,列表如下: PHP Excel Reader classes 1. Read Excel Spreadsheets u ...
- 最受欢迎的5款PHP框架记录,我居然一个不知道。。。
1. CodeIgniter Framework CodeIgniter 是目前使用最广泛的 PHP 框架.CodeIgniter 是一个简单快速的PHP MVC 框架.EllisLab 的工作人员发 ...
- poj 2777 Count Color(线段树 区间更新)
题目:http://poj.org/problem?id=2777 区间更新,比点更新多一点内容, 详见注释, 参考了一下别人的博客.... 参考博客:http://www.2cto.com/kf/ ...
- Android中Java反射技术的使用示例
import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Metho ...