数据库tnsping 延时过大(转)

今天上午发现数据库用户连接速度比前一天要慢.在终端和服务器上分别用tnsping 来查看反应时间,发现延时很长,有些不正常.现象如下:

monitor@crm1:/oracle/app/oracle/product/9.2/network/log>tnsping boss1

TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production on 29-JUN-2007 15:00:02

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:

/oracle/app/oracle/product/9.2/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcp)(host = 192.168.0.2)(port = 1521))) (CONNECT_DATA = (SID = boss1)))

OK (1650 msec)

monitor@crm1:/oracle/app/oracle/product/9.2/network/log>tnsping boss1

TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production on 29-JUN-2007 15:00:05

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:

/oracle/app/oracle/product/9.2/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcp)(host = 192.168.0.2)(port = 1521))) (CONNECT_DATA = (SID = boss1)))

OK (1590 msec)

从所反回的时间分析可能是由于监听端口的压力较大,有很多的新连接不断的重新连.怀疑有大量的短连接.是否有人对应用程序的连接方式有所改动.

查询视图v$session 发现:

select to_char(LOGON_TIME,'yyyy-mm-dd hh24:mi:ss'),PROGRAM,sid, username,status,osuser from v$session where status='ACTIVE' and username is not null and to_char(LOGON_TIME,'yyyy-mm-dd hh24:mi:ss')>'2007-06-29 11:10:00' order by LOGON_TIME,SCHEMANAME,PROGRAM;

2007-06-29 11:07:41 RPubPower@AS2 (TNS V1-V3) 228 PROG_USER ACTIVE boss1

2007-06-29 11:07:41 RPubPower@AS2 (TNS V1-V3) 2617 PROG_USER ACTIVE boss1

2007-06-29 11:07:41 RPubPower@AS2 (TNS V1-V3) 3015 PROG_USER ACTIVE boss1

2007-06-29 11:07:42 RPubPower@AS2 (TNS V1-V3) 828 PROG_USER ACTIVE boss1

2007-06-29 11:07:42 RPubPower@AS2 (TNS V1-V3) 2584 PROG_USER ACTIVE boss1

2007-06-29 11:07:44 RPubPower@AS2 (TNS V1-V3) 1789 PROG_USER ACTIVE boss1

2007-06-29 11:07:44 RPubPower@AS2 (TNS V1-V3) 1858 PROG_USER ACTIVE boss1

2007-06-29 11:07:44 RPubPower@settle1 (TNS V1-V3) 999 PROG_USER ACTIVE boss1

2007-06-29 11:07:44 RPubPower@settle1 (TNS V1-V3) 2287 PROG_USER ACTIVE boss1

2007-06-29 11:07:44 RPubPower@settle1 (TNS V1-V3) 1257 PROG_USER ACTIVE boss1

我们看出RPubPower服务产生很多的短连接,造成的监听端口的压力,导致了连接沿时。经确定此服务是28日晚新上业务,程序中会产生大量的短连接。后应用人员进行了修改,将短连接变成长连接。现象消失。

tnsping">monitor@crm1:/tmp>tnsping boss1 20

TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production on 29-JUN-2007 17:04:06

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:

/oracle/app/oracle/product/9.2/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcp)(host = 192.168.0.2)(port = 1521))) (CONNECT_DATA = (SID = boss1)))

OK (110 msec)

OK (50 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (10 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

tnsping">monitor@crm1:/tmp>tnsping boss2 10

TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production on 29-JUN-2007 17:23:15

Copyright (c) 1997 Oracle Corporation. All rights reserved

Used parameter files:

/oracle/app/oracle/product/9.2/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcp)(host = 1192.168.0.1)(port = 1521))) (CONNECT_DATA = (SID = boss2)))

OK (60 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (10 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec)

OK (0 msec

如果应用不能轻易修改的话我们可以用使用多个监听的方法来缓解监听端口的压力

在服务器端:配置多个listener,每个listener走不同的端口;
在客户端,配置tnsnames.ora文件,如下:
boss1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE=ON)
(FAILOVER=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1523))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1524))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1525))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1526))
)
(CONNECT_DATA =
(SERVICE_NAME = boss)
)
)

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9650775/viewspace-923227/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9650775/viewspace-923227/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值