记录一则数据库连接故障ORA-12560,ORA-12518
环境:Win Server 2008 R2 + Oracle 11.2.0.1
故障:客户反映数据库连接不上,本机sysdba和网络连接都连接不上。
一、确认故障
二、排查原因
一、确认故障
1.1 服务器尝试sysdba登录
```
PS C:\Users\Administrator> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 18 09:39:14 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS: 协议适配器错误
<h2 id="1.2">1.2 服务器尝试通过网络连接</h2>
PS C:\Users\Administrator> sqlplus system/oracle@xxoradb
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 18 09:34:01 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12518: TNS: 监听程序无法分发客户机连接
<h1 id="2">二、排查原因</h1>
<h2 id="2.1"> 2.1 ORA-12560错误初步排查原因 </h2>
ORA-12560错误官方说明:
$ oerr ora 12560
12560, 00000, "TNS:protocol adapter error"
// *Cause: A generic protocol adapter error occurred.
// *Action: Check addresses used for proper protocol specification. Before
// reporting this error, look at the error stack and check for lower level
// transport errors. For further details, turn on tracing and reexecute the
// operation. Turn off tracing when the operation is complete.
MOS相关文档:Bequeath connection fails with ORA-12560 on Windows (文档 ID 1986438.1)
可能原因:
> Environmental variables are not set correctly. This is a common issue on Windows.
> The following commands do not show proper settings:
> echo %ORACLE_HOME%
> echo %ORACLE_SID%
> echo %PATH%
解决方法:
> Please do the following:
>
> set ORACLE_HOME= <<<<< enter the Oracle Home path here
> set ORACLE_SID= <<<<< enter the Oracle SID name here
> set PATH=%PATH%; <<<<< add the path of %ORACLE_HOME%/bin <<<<< this is the directory where "sqlplus.exe" exists
> echo %ORACLE_HOME% <<<<< this verifies the Oracle home value
> echo %ORACLE_SID% <<<<< this verifies the Oracle SID value
可是<font color="red">目前情况是,环境变量ORACLE_SID设置没有问题。而Windows环境,ORACLE_HOME并不需要在环境变量中设置,而是在注册表中</font>
关于这个ORACLE_HOME环境变量的问题可参考MOS的另一篇文章:How to Set or Switch Oracle Homes on Windows (Doc ID 969581.1)
由于业务目前已经是中断状态,所以可以重启监听和数据库服务,检查注册表信息,但问题依旧。
这里实际走了弯路,因为sqlplus命令是正常使用的,所以在环境变量方面就没多想PATH的问题。
<h2 id="2.2">2.2 ORA-12518错误排查原因 </h2>
ORA-12518错误官方说明:
$ oerr ora 12518
12518, 00000, "TNS:listener could not hand off client connection"
// *Cause: The process of handing off a client connection to another process
// failed.
// *Action: Turn on listener tracing and re-execute the operation. Verify
// that the listener and database instance are properly configured for
// direct handoff. If problem persists, call Oracle Support.
// *Comment: The problem can be worked around by configuring dispatcher(s)
// to specifically handle the desired presentation(s), and connecting
// directly to the dispatcher, bypassing the listener.
查看当前监听配置文件:
listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-1XXXXXXXXXX)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC521))
)
)
ADR_BASE_LISTENER = D:\app\Administrator
修改监听配置文件加入静态监听配置内容:
listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = xxoradb)
(ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
(SID_NAME = xxoradb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-1XXXXXXXXXX)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC521))
)
)
ADR_BASE_LISTENER = D:\app\Administrator
重启监听后再测试,发现加入静态监听后可以连接到数据库了,同时服务器上的PL/SQL工具也可以正常连接到数据库了。
C:\Users\Administrator>sqlplus system/oracle@xxoradb
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 18 10:52:24 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
<font color="red">这样,就先解决了客户端网络连接的问题。</font>
<h2 id="2.3">2.3 ORA-12560错误再次排查原因</h2>上面解决了客户端的连接问题,但问题还没有完美解决,因为目前本地sysdba仍然还是无法登陆,依然报错ORA-12560:
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 18 10:59:11 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS: 协议适配器错误
请输入用户名:
<font color="red">这时候就怀疑可能是机器上安装了多个Oracle程序导致,也就是说这个sqlplus命令可能是某个客户端的sqlplus程序,</font>
下面验证下是不是这个情况:
看到Oracle产品目录下,11.2.0文件夹下有多个文件夹存在
D:\app\Administrator\product\11.2.0>dir
驱动器 D 中的卷没有标签。
卷的序列号是 0A43-E08A
D:\app\Administrator\product\11.2.0 的目录
2016/01/26 12:26 .
2016/01/26 12:26 ..
2016/01/26 12:35 client_1
2016/01/26 12:23 dbhome_1
2016/01/26 12:25 dbhome_2
0 个文件 0 字节
5 个目录 200,137,936,896 可用字节
看起来的确安装有多个Oracle软件,从命名规则来看,应该是1个客户端,两个DB。
查看当前系统注册表中ORACLE_HOME的值为`D:\app\Administrator\product\11.2.0\dbhome_1`
那么我们使用的sqlplus程序是不是这个路径下的呢?
进一步查看系统环境变量PATH的值,
D:\app\Administrator\product\11.2.0\client_1\BIN;D:\app\Administrator\product\11.2.0\dbhome_1\BIN;D:\app\Administrator\product\11.2.0\dbhome_1;C:\Program Files (x86)\Common Files\NetSarang;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
<font color="red">果然第一个查找路径是客户端的,不是我们想要的服务端程序路径,第二个路径才是。</font>
现在问题就明朗了,我们把客户端的这个路径`D:\app\Administrator\product\11.2.0\client_1\BIN;`删掉。
然后重新打开cmd,发现已经可以正常sysdba登录
C:\Users\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 18 11:16:53 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
最后,再确认下,PL/SQL等工具也可以重新正常登录。至此,问题完美解决。
记录一则数据库连接故障ORA-12560,ORA-12518的更多相关文章
- oracle的listener.ora sqlnet.ora tnsnames.ora三个文件的关联性
学习:http://www.cnblogs.com/william-lee/archive/2010/10/20/1856261.html 之前因为安装的是windows server 2008 r2 ...
- listener.ora/sqlnet.ora/tnsnames.ora配置文件详解
oracle网络配置 三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora ,都是放在$ORACLE_HOME/network/admin目录下. 英文说明: The ...
- ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
不论是单实例还是RAC,对于非缺省端口下(1521)的监听器,pmon进程不会将service/instance注册到监听器,即不会实现动态注册.与单实例相同,RAC非缺省端口的监听器也是通过设置参数 ...
- oracle的sqlnet.ora,tnsnames.ora,listener.ora三个配置文件
总结: 1 .三个配置文件都是放在$ORACLE_HOME\network\admin目录下. 2 .sqlnet.ora确定解析方式 3 .listener.ora上设SID_NAME,通常用于JD ...
- oracle的sqlnet.ora , tnsnames.ora , Listener.ora 文件的作用(转)
oracle网络配置三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora ,都是放在$ORACLE_HOME/network/admin目录下.1. sqlnet.o ...
- oracle错误(ORA:12154 ORA:01034 和 ORA:27101 ORA-18008 ORA-01081)
按照正常操作流程,启动项目,发现项目报错,原因是连接不上oracle数据库, PLSQL连接时报错,错误码 ORA:12154 无法解析指定的连接标识符 第一次,遇到这个错误,在网上找了资料都是需要 ...
- 随笔记录 MBR扇区故障系统备份与还原 2019.8.7
系统备份: [root@localhost ~]# mkdir /abc [root@localhost ~]# mount /dev/sdb1 /abc [root@localhost ~]# dd ...
- 随笔记录 grub引导故障修复 2019.8.7
系统备份: [root@localhost ~]# mkdir /abc [root@localhost ~]# mount /dev/sdb1 /abc [root@localhost ~]# dd ...
- ORACLE RAC 监听配置 (listener.ora tnsnames.ora)
Oracle RAC 监听器的配置与单实例稍有不同,但原理和实现方法基本上是相同的.在Oracle中 tns进程用于为指定网络地址上的一个或多个Oracle 实例提供服务注册,并响应来自客户端对该服务 ...
随机推荐
- Daily Scrum02 12.11
今天的会议的主要内容基本是解决界面组的问题,原本开始进行人员分配的时候没有考虑到要花特别长的时间为美化界面整理素材,且由于进行素材PS的同学的时间安排问题,和不熟练,很久没有将素材准备这项任务完成.因 ...
- Node.js Ubuntu下安装
安装 Node.js 依次执行以下指令: sudo apt-get update sudo apt-get install -y python-software-properties python g ...
- 拒绝了对对象 'base_config' (数据库 '****',架构 'dbo')的 SELECT 权限
在网上看了很多资料都是空说一谈,都只是说很简单,然后没有说遇到这样的情况具体该怎么做,看到这里都知道是权限问题,其实我们每一个人都知道,又是我觉得我还是要给以后遇到的朋友个解决方法: 这里用到的数据 ...
- Windows和Linux都有的Copy-on-write技术
Windows和Linux都有的Copy-on-write技术 MySQL技术内幕Innodb存储引擎第2版 P375 SQL Server2008 实现与维护(MCTS教程)P199 LVM快照技术 ...
- Microsoft开源跨平台的序列化库——Bond
上个月Microsoft开源了Bond,一个跨平台的模式化数据处理框架.Bond支持跨语言的序列化/反序列化,支持强大的泛型机制能够对数据进行有效地处理.该框架在Microsoft公司内部的高扩展服务 ...
- 简单一招实现json数据可视化
开发一个内部功能时碰到的需求,要把json数据在页面上展示出来,平时浏览器会安装jsonView这样的扩展来看json数据,但是程序要用到的话该怎么办呢?今天在网上搜索的时候,发现了这个小技巧,分享一 ...
- Module Zero安装
返回<Module Zero学习目录> 使用模板创建(自动方式) 手动安装 核心(领域)层 基础设施层 展示层 这里需要抱歉的是,这里使用的博客园的Markdown语法,代码显示不是很好看 ...
- 2013 duilib入门简明教程 -- 复杂控件介绍 (13)
首先将本节要介绍的控件全部拖到界面上,并调整好位置,如图: 然后将Name属性改成其他名字, 不能是[控件名+UI+数字]这种,因为这是DuiDesigner ...
- WCF学习之旅—WCF第二个示例(七)
三.创建客户端应用程序 若要创建客户端应用程序,你将另外添加一个项目,添加对该项目的服务引用,配置数据源,并创建一个用户界面以显示服务中的数据. 在第一个步骤中,你将 Windows 窗体项目添加到解 ...
- Referenced file contains errors (http://www.springframework.org/schema/context). For more information, right click on the message in the Problems
spring 配置文件的DTD或schema出问题,一般两种情况: 1.当前网络环境不稳定,按住ctrl+"http://www.springframework.org/schema/con ...