--同事hadoop连接oracle导入数据,界面报错,后台alert日志报错tns相关错误:

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

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: 30-DEC-2016 10:34:30
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12606
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.220)(PORT=52684))
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:39:50 2016
Starting background process SMCO
Fri Dec 30 10:39:50 2016
SMCO started with pid=18, OS id=32231
Fri Dec 30 10:55:24 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:29 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:29 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:30 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:30 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:30 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:30 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 10:55:30 2016
WARNING: inbound connection timed out (ORA-3136)
Fri Dec 30 11:02:53 2016
WARNING: inbound connection timed out (ORA-3136)

查看listener.log文件,发现报错信息如下:

[oracle@oracle trace]$ cat /home/oracle/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml |grep TNS
<txt>TNS-12528: TNS:listener: all appropriate instances are blocking new connections
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
<txt>TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
  TNS-00507: Connection closed
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
<txt>TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
  TNS-00507: Connection closed
<txt>TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
  TNS-00512: Address already in use

监听文件报错如下:

***********************************************************************
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: 30-DEC-2016 11:12:57
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535
    TNS-12535: TNS:operation timed out
    ns secondary err code: 12606
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.221)(PORT=51820))

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

--网上查到eygle博客,解决ora-3136错误方案,记录如下:

最近一台新上线的Oracle10gR2数据库在警告日志文件中(alert.log)持续出现如下错误:

Tue Jul 18 23:09:22 2006
WARNING: inbound connection timed out (ORA-3136)
Tue Jul 18 23:09:23 2006
WARNING: inbound connection timed out (ORA-3136)
Tue Jul 18 23:09:25 2006
WARNING: inbound connection timed out (ORA-3136)
Tue Jul 18 23:09:30 2006
WARNING: inbound connection timed out (ORA-3136)
Tue Jul 18 23:12:15 2006
WARNING: inbound connection timed out (ORA-3136)
同时在sqlnet.log中记录了如下错误:

Fatal NI connect error 12170.

VERSION INFORMATION:
TNS for Linux: Version 10.2.0.2.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 10.2.0.2.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 10.2.0.2.0 - Production
Time: 19-JUL-2006 11:25:26
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: TNS:operation timed out
ns secondary err code: 12606
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.123)(PORT=58147))

这是和网络连接相关的一个错误,Metalink上给出了如下的解决方案:

1.set INBOUND_CONNECT_TIMEOUT_<listenername>=0 in listener.ora
2. set SQLNET.INBOUND_CONNECT_TIMEOUT = 0 in sqlnet.ora of server.
3. stop and start both listener and database.
4. Now try to connect to DB and observe the behaviour

这里重起数据库和Listener我认为是没有必要的,我们reload一下Listner应该就可以了.

[oracle@order admin]$ lsnrctl

LSNRCTL for Linux: Version 10.2.0.2.0 - Production on 19-JUL-2006 15:26:33

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.9.11)(PORT=1521)))
The command completed successfully
LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.9.11)(PORT=1521)))
Services Summary...
Service "order" has 2 instance(s).
Instance "order", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Instance "order", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully

LSNRCTL> show inbound_connect_timeout
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.9.11)(PORT=1521)))
LISTENER parameter "inbound_connect_timeout" set to 0
The command completed successfully
LSNRCTL> exit

修改之后,观察了一段时间,目前正常.

关于SQLNET.INBOUND_CONNECT_TIMEOUT参数,Oracle建议修改该参数,以避免denial-of-service攻击.

引用一段Oracle文档说明如下:

SQLNET.INBOUND_CONNECT_TIMEOUT
Purpose
Use the SQLNET.INBOUND_CONNECT_TIMEOUT parameter to specify the time, in seconds, for a client to connect with the database server and provide the necessary authentication information.

If the client fails to establish a connection and complete authentication in the time specified, then the database server terminates the connection. In addition, the database server logs the IP address of the client and an ORA-12170: TNS:Connect timeout occurred error message to the sqlnet.log file. The client receives either an ORA-12547: TNS:lost contact or an ORA-12637: Packet receive failed error message.

Without this parameter, a client connection to the database server can stay open indefinitely without authentication. Connections without authentication can introduce possible denial-of-service attacks, whereby malicious clients attempt to flood database servers with connect requests that consume resources.

To protect both the database server and the listener, Oracle Corporation recommends setting this parameter in combination with the INBOUND_CONNECT_TIMEOUT_listener_name parameter in the listener.ora file. When specifying values for these parameters, consider the following recommendations:

Set both parameters to an initial low value.
Set the value of the INBOUND_CONNECT_TIMEOUT_listener_name parameter to a lower value than the SQLNET.INBOUND_CONNECT_TIMEOUT parameter.
For example, you can set INBOUND_CONNECT_TIMEOUT_listener_name to 2 seconds and INBOUND_CONNECT_TIMEOUT parameter to 3 seconds. If clients are unable to complete connections within the specified time due to system or network delays that are normal for the particular environment, then increment the time as needed.

See Also:
Oracle9i Net Services Administrator's Guide for information about configuring these parameters

Default
None

Example
SQLNET.INBOUND_CONNECT_TIMEOUT=3

按照eygle博客思路,修改sqlnet.ora文件如下:

SQLNET.INBOUND_CONNECT_TIMEOUT = 0

修改参数并reload监听后,测试正常,问题解决。

一次tns连接错误的解决过程的更多相关文章

  1. Sqlserver 2008 error 40出现连接错误的解决方法

    说明(2017-5-25 15:00:16): 核心:把端口号改成1433 Sqlserver 2008 error 40出现连接错误的解决方法

  2. linux服务器报No space left on device错误的解决过程记录

    起因 今天在本地提交了点代码,但到服务器上git pull的时候提示No space left on device,第一反应是猜想可能硬盘满了(很有可能是log导致的),不过想想又觉得不太可能,这台服 ...

  3. 【数据库】 Sqlserver 2008 error 40出现连接错误的解决方法

    经常要连接到远程数据库上,因此常常碰到这个错误,然后又屡次忘记解决方法,所以今天坐下笔迹,好下次能快速回忆起来. 一.首先检查数据库的TCP/TP是否启动 1.启动Sql server配置管理器 2. ...

  4. MySQL多Text字段报8126错误(解决过程)

    一.背景 我们的MySQL数据库有一张10个Text的字段的表,还包括几个char和varchar字段,由于业务需求,我在表中加多一个Text字段的时候,插入记录的出现了下面的错误: Row size ...

  5. Python3.7 发送邮件 报‘[WinError 10061] 由于目标计算机积极拒绝,无法连接’错误的解决方法

    背景: 最近在练习Python 的邮件发送功能 照着教程写了一个简单的demo 结果运行时报如下错误:[WinError 10061] 由于目标计算机积极拒绝,无法连接. 如图: 解决路径如下: St ...

  6. "provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接"错误的解决方法

    这个错误主要有以下几个原因造成: 1. 错误的连接字符串:例如数据源的实例名称“\"错误写成"/"了 2.Named Pipes(NP)没有启动 其他原因,详见:http ...

  7. ubuntu安装openssh-server 报依赖错误的解决过程

    ubuntu自带的有openssh-client,所以可以通过 ? 1 ssh username@host 来远程连接linux 可是要想通过ssh被连接,ubuntu系统需要有openssh-ser ...

  8. [转][C#]Oracle 连接错误的解决

    错误1: .NET连接oracle,提示错误OCIEnvCreate 失败,返回代码为 -1,但错误消息文本不可用 两个原因: 1. 权限,把 Oracle 所在目录权限设置成 authenticat ...

  9. anaconda下载包时网络连接错误的解决方法(CondaHTTPError:HTTP 000 connection failed for url)

    继上一篇<在WSL上搭载python编程环境>之后,下载软件和创建新环境的过程非常艰辛,下载太慢,以至于常常中断. 不论用conda安装一些python的包,还是创新独立的编程环境时,出现 ...

随机推荐

  1. Swing开发图形界面有如下优势

    Swing开发图形界面有如下优势 : Swing组件不再依赖于本地平台的GUI,无须采用各种平台的GUI交集,因此Swing提供了大量图形界面组件,远远超出了AWT所提供的图形界面组件集. Swing ...

  2. Javascript实用代码片段(译)

    原文:http://www.bestdesigntuts.com/10-time-saving-javascript-code-snippets-for-web-developers 1. 同高或同宽 ...

  3. 转载:erlang程序优化点的总结

    erlang程序优化点的总结(持续更新) 转自:http://wqtn22.iteye.com/blog/1820587 转载请注明出处 注意,这里只是给出一个总结,具体性能需要根据实际环境和需要来确 ...

  4. 【Java面试题】24 sleep() 和 wait() 有什么区别? 详细解析!!!!

    第一种解释: 功能差不多,都用来进行线程控制,他们最大本质的区别是:sleep()不释放同步锁,wait()释放同步缩.         还有用法的上的不同是:sleep(milliseconds)可 ...

  5. 电视不支持AirPlay镜像怎么办?苹果iPhone手机投屏三种方法

    导读:苹果手机多屏互动功能在哪里?iPhone苹果手机没有AirPlay镜像怎么办?三种方法教你苹果iPhone手机怎么投影到智能电视上. 前言: 苹果iPhone手机投屏到电视设备上,需要使用到Ai ...

  6. 【R】array 2 string

    paste(1:10, collapse = '') http://stackoverflow.com/questions/2098368/how-do-i-concatenate-a-vector- ...

  7. 【Matlab】运动目标检测之“帧差法”

    videoObj = VideoReader('4.avi');%读视频文件 nframes = get(videoObj, 'NumberOfFrames');%获取视频文件帧个数 : nframe ...

  8. 什么是mysql的元数据呢?

    需求描述: 什么是mysql的元数据?metadata? 概念解释: 简单来说:任何描述数据库的数据就是数据库的元数据库(与数据库中存在的内容相对) 比如,用于描述一个冰箱是如何构成,怎么使用的就是冰 ...

  9. Trie树(字典树)(1)

    Trie树.又称字典树,单词查找树或者前缀树,是一种用于高速检索的多叉树结构. Trie树与二叉搜索树不同,键不是直接保存在节点中,而是由节点在树中的位置决定. 一个节点的全部子孙都有同样的前缀(pr ...

  10. mybatis由浅入深day02_6延迟加载_延迟加载总结

    6 延迟加载 6.1 什么是延迟加载 需要查询关联信息时,使用mybatis延迟加载特性可有效的减少数据库压力,首次查询只查询主要信息,关联信息等用户获取时再加载. resultMap可以实现高级映射 ...