<转>TNS-12547 错误与 listener.log > 2G

5点多的时候还在睡梦里被人吵醒,说是数据库连不上了。晕菜。
跑过来一看。连上服务器conn / as sysdba可以登陆。用另一台机器以客户端连进去:
 
[oracle@smsgw admin]$ tnsping primary
TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 26-NOV-2006 07:06:25
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = *****)(PORT = 1521))) (CONNECT_DATA = (SID = smsnew)))
TNS-12541: TNS:no listener
果然,报TNS-12541: TNS:no listener错。
 
登陆服务器,查看listener的状态。
[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 9.2.0.7.0 - Production on 26-NOV-2006 06:58:25
Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

启动listener 看看:
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 9.2.0.7.0 - Production on 26-NOV-2006 06:58:10
Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.
Starting /data/oracle/product/9.2.0/bin/tnslsnr: please wait...
TNS-12547: TNS:lost contact
 TNS-12560: TNS:protocol adapter error
  TNS-00517: Lost contact
  
Linux Error: 32: Broken pipe
竟然报这样的错误,以前可是没有遇到过,本来以为手到擒来的事,看来是遇上点麻烦了。
开始以为是网片坏了,但是用这台机的网卡可以ping 通别的服务器,这就将网卡坏的可能性给排除了。

没办法了,baidu一下吧。简索Linux Error: 32: Broken pipe 找到原因,原来是listener.log超出2G了,以前只是听说过这个错误,没想到竟然被碰上了,晕。

[oracle@localhost log]$ pwd
/data/oracle/product/9.2.0/network/log
[oracle@localhost log]$ du -sh *
4.0K    dbsnmp.nohup
4.0K    listenerdb.log
2.1G    listener.log
4.0K    sqlnet.log
4.0K    start.log
4.0K    status.log
4.0K    stop.log
0       z
[oracle@localhost log]$ mv listener.log listener.log.bak
[oracle@localhost log]$ cat /dev/null > listener.log
[oracle@localhost log]$ ls -l
total 2099228
-rw-r--r--  1 oracle oinstall        813 Mar  1  2006 dbsnmp.nohup
-rw-r--r--  1 oracle oinstall       1880 Sep 22 10:34 listenerdb.log
-rw-r--r--  1 oracle oinstall          0 Nov 26 07:09 listener.log
-rw-r--r--  1 oracle oinstall 2147483647 Nov 26 04:27 listener.log.bak
-rw-r--r--  1 oracle oinstall       3098 Nov 26 06:55 sqlnet.log
-rw-r--r--  1 oracle oinstall        484 Aug 20 10:29 start.log
-rw-r--r--  1 oracle oinstall        976 Mar  1  2006 status.log
-rw-r--r--  1 oracle oinstall       1927 Aug 20 10:29 stop.log
-rw-r--r--  1 oracle oinstall          0 Feb 18  2004 z

再次重起listener。

[oracle@localhost ~]$ lsnrctl

LSNRCTL for Linux: Version 9.2.0.7.0 - Production on 26-NOV-2006 07:10:10

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
LSNRCTL> start
Starting /data/oracle/product/9.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 9.2.0.7.0 - Production
System parameter file is /data/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /data/oracle/product/9.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.7.0 - Production
Start Date                26-NOV-2006 07:10:16
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /data/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /data/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "**" has 1 instance(s).
  Instance "**", status UNKNOWN, has 1 handler(s) for this service...
Service "**" has 1 instance(s).
  Instance "**", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

客户端tnsping试一下:
[oracle@smsgw admin]$ tnsping primary
TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 26-NOV-2006 07:10:33
Copyright (c) 1997 Oracle Corporation.  All rights reserved.
Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ****)(PORT = 1521))) (CONNECT_DATA = (SID = smsnew)))
OK (0 msec)
说明可以连接上。

至此,此问题解决。
 
 
其实可以制定一个定时的Job去清理listener.log:
 
[oracle@localhost log]$ more ~/clear_listenerlog.sh
cd /data/oracle/product/9.2.0/network/log/
mv listener.log  listener `date +%F`.log.bak
[oracle@localhost log]$ ls -l ~/clear_listenerlog.sh
-rw xr- xr- x  1 oracle oinstall 88 Nov 27 15:07 /home/oracle/clear_listenerlog.sh
[oracle@localhost log]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.8411 installed on Fri Mar  3 13:01:58 2006)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
#00 02 * * * sh /app/shell/oraclesh/logic_bak.sh

00 01 1 * * /home/oracle/clear_listenerlog.sh

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

转载于:http://blog.itpub.net/24032200/viewspace-672797/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值