AWS数据库云服务器出现了连接超时的错误,于是查看相关时段的alert日志,发现了如下的错误:

***********************************************************************
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.4.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
Time: 25-OCT-2017 05:00:12
Tracing not turned on.
Tns error struct:
ns main err code: 12535

TNS-12535: TNS:operation timed out
ns secondary err code: 12560
nt main err code: 505

TNS-00505: Operation timed out
nt secondary err code: 110
nt OS err code: 0
Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=x.x.x.x)(PORT=4459))
Wed Oct 25 05:18:13 2017
***********************************************************************

网络连接超时,鉴于以前也经常遇到类似的TNS错误,因此需要彻底搞定它。查看MOS后找到如下文章:

Alert Log Errors: 12170 TNS-12535/TNS-00505: Operation Timed Out (文档 ID 1628949.1)

主要内容如下:

CAUSE
The 'nt secondary err code' identifies the underlying network transport, such as (TCP/IP) timeout limit. In the current case 60 identifies Windows underlying transport layer.
The "nt secondary err code" will be different based on the operating system:
Linux x86 or Linux x86-64: "nt secondary err code: 110"
HP-UX : "nt secondary err code: 238"
AIX: "nt secondary err code: 78"
Solaris: "nt secondary err code: 145"

The alert.log message indicates that a connection was terminated AFTER it was established to the instance. In this case, it was terminated 2 hours and 3 minutes after the listener

handed the connection to the database.

This would indicate an issue with a firewall where a maximum idle time setting is in place.
The connection would not necessarily be "idle". This issue can arise during a long running query or when using JDBC Thin connection pooling.
If there is no data 'on the wirte for lengthy periods of time for any reason, the firewall might terminate the connection.

SOLUTION
The non-Oracle solution would be to remove or increase the firewall setting for maximum idle time. In cases where this is not feasible,
Oracle offers the following suggestion:

The following parameter, set at the **RDBMS_HOME/network/admin/sqlnet.ora, can resolve this kind of problem.
DCD or SQLNET.EXPIRE_TIME can mimic data transmission between the server and the client during long periods of idle time.

SQLNET.EXPIRE_TIME=n Where <n> is a non-zero value set in minutes.

Once this change is in place, there is NO need to restart the listener or the database.
The change will be in place for all newly spawned server processes following the change.
Be aware that connections that were established prior to this setting would not be affected by this change. Therefore, you may continue to experience some timeouts until all remote
connection are established with this setting in place.

See the following : Note 257650.1 Resolving Problems with Connection Idle Timeout With Firewall

从文中我们看出,这可能是防火墙策略或者JDBC连接池的原因,服务器自动将长时间没有响应的会话关闭,可以通过设置SQLNET.EXPIRE_TIME来解决。

文中也列出了不同操作系统报出的不同nt secondary err code。

问题的基本诊断思路如下:

1.查找问题时间段的alert日志和监听日志,其位置分别是$ORACLE__BASE/diag/rdbms/db_name/$ORACLE_SID/trace/和$ORACLE__BASE/diag/tnslsnr/hostname/listener/trace/

2.如果alert日志显示如上报错,但listener日志显示正常,那么说明确实是数据库以外的问题,按如上文档的solution解决即可。

3.如果监听日志显示了其他报错,那么再根据报错找到相应的解决办法。

TNS-12535: TNS:operation timed out的更多相关文章

  1. TNS-12535: TNS:operation timed out案例解析

    一数据库突然连接不上,在自己电脑上使用SQL Developer也连接不上.立即使用SecureCRT连接上了这台服务器,从下面几个方面检查. 1:检查了数据库的状态是否正常 $ sqlplus / ...

  2. TNS-12535: TNS:operation timed out、TNS-00505: Operation timed out

    在查看alert日志的时候发现: 1 *********************************************************************** 2 3 Fatal ...

  3. Python安装pywinauto时遇到error: The read operation timed out解决方法

    Python结合Pywinauto 进行 Windows UI 自动化,安装pywinauto时遇到的一些问题: 解决方法:很明显是链接超时国外网站你懂的V_P_N吧,直接通过报错信息的链接复制到浏览 ...

  4. “SSLError: The read operation timed out” when using pip

    Downloading/unpacking Django>=1.5.1,<1.6 (from -r requirements.txt (line 1)) Downloading Djang ...

  5. mac 配置 ssh 到git (Could not resolve hostname github.com, Failed to connect to github.com port 443 Operation timed out)

    1.进入终端命令行 (1)输入:cd .ssh/ 进入到.ssh后,输入ls,会输出“known_hosts”,如果没有创建过rsa的话 (2)输入:man ssh-add (3)输入:ssh-key ...

  6. socket.timeout: The read operation timed out 更改pip源至国内镜像,显著提升下载速度

    出现socket.timeout: The read operation timed out  错误的时候,可能是pip源不稳定,改改试试看!  经常在使用Python的时候需要安装各种模块,而pip ...

  7. open-falcon ---安装Dashboard时候报错"SSLError: The read operation timed out"

    在部署open-falcon环境过程中,安装Dashboard时候报错"SSLError: The read operation timed out".如下: [root@open ...

  8. 服务器22端口连接超时 ssh: connect to host *** port 22: Operation timed out

    最近酸酸乳出问题,连接v社服务器发现碰到 ssh: connect to host master port 22: Connection timed out 的问题.现在对该问题做一下可能出现的问题 ...

  9. 解决 connect to host github.com port 22 operation timed out

    本来好好地.不知道为什么不能push了.估计是被墙,于是搜搜解决办法.改换端口 参考 https://mozillazg.com/2015/08/use-443-port-fix-github-con ...

随机推荐

  1. Spring cloud的Maven插件(一):repackage目标

    简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...

  2. 菜鸟系列docker——docker镜像上(3)

    1. 镜像image 镜像和容器的关系就和安装包和程序的关系一样,有了镜像才可以启动容器,容器是镜像的一个运行实例. 1.1 镜像的结构 通过第二节仓库,可能很多看官已经查看到镜像是分层的,接下来将对 ...

  3. 一文带你看懂cookie,面试前端不用愁

    本文由云+社区发表 在前端面试中,有一个必问的问题:请你谈谈cookie和localStorage有什么区别啊? localStorage是H5中的一种浏览器本地存储方式,而实际上,cookie本身并 ...

  4. Java——String对象

    前言 实际上任何语言都没有提供字符串这个概念,而是使用字符数组来描述字符串.Java里面严格来说也是没有字符串的,在所有的开发里面字符串的应用有很多,于是Java为了应对便创建了String类这个字符 ...

  5. 第8章 CentOS包管理详解

    8.1 Linux上构建C程序的过程 在说明包相关的内容之前,我觉得有必要说一下在Linux上构建一个C程序的过程.我个人并没有学习过C,内容总结自网上,所以可能显得很小白,而且也并非一定正确,只希望 ...

  6. 第9章 Linux进程和信号超详细分析

    9.1 进程简单说明 进程是一个非常复杂的概念,涉及的内容也非常非常多.在这一小节所列出内容,已经是我极度简化后的内容了,应该尽可能都理解下来,我觉得这些理论比如何使用命令来查看状态更重要,而且不明白 ...

  7. 南大算法设计与分析课程复习笔记(3)L3 - Recursion

    一.递归方程 按照分治的思想,可以将一个递归的复杂度写成递归方程 一.解递归方程--猜然后证明 该方法又称为代入法,步骤如下: 1.猜解的形式 2.数学归纳法证明正确 例子: 我们假设有如下递归式: ...

  8. 大话DI依赖注入+IOC控制反转(二) 之 浅析.Net Core中的DI与IOC

      转发时请注明原创作者及地址,否则追究责任.原创:alunchen 在上一篇文章中,我们聊了很多关于定义的方面,比较孤燥,下面我们结合.Net Core聊一下依赖注入&控制反转. 三种对象生 ...

  9. Laravel5性能优化技巧

    分享一些 Laravel 开发的最佳实践,还有调优技巧,后面陆续整理中 1.配置缓存信息 使用laravel自带的artisan命令,将所有config里面的配置都缓存到一个文件里. php arti ...

  10. 消息队列redis

    1.消息队列流程 2.接收用户请求 <?php header("Content-type:text/html;charset=utf-8"); //首先加载redis组键 $ ...