清理监听日志的方法
2015-06-25 15:32
459 查看
清理监听日志处理的方法:
1:首先停止监听服务进程(tnslsnr)记录日志。
lsnrctl set log_status off;
2:将监听日志文件(listener.log)复制一份,以listener.log.yyyymmdd格式命名
cp listener.log listener.log.20150622
3、将监听日志文件(listener.log)清空。清空文件的方法有很多
cat /dev/null > listener.log
4:开启监听服务进程(tnslsnr)记录日志
lsnrctl set log_status on;
对于这种listener.log增长非常迅速的系统,可以关闭监听日志lsnrctl set log_status off,不让监听写日志到文件。也可以写个job定期清理。
监听日志文件改变:
11g开始引入ADR,监听日志就从原来的$ORACLE_HOME/network/log/listener.log变为了$ORACLE_BASE/diag/tnslsnr/hostname/listener/alert/log.xml
Normally, log.xml will only reflect very recent data, and it won't get purged. However, as the log file grows, it
will be archived into a log_1.xml, log_2.xml and so on, and those files will get purged instead.
The "archived" log_1.xml, etc. will not show up until the log.xml file gets to 10MBytes.
$ORACLE_BASE/diag/tnslsnr/hostname/listener/alert 目录下的xml文件以每个10m的方式在不停增多,之前简单的只定期清理
$ORACLE_HOME/network/log/listenr.log变为还需多清理alert目录下的
C:\Documents and Settings\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 13:58:32
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 21-5月 -2015 16:04:08
正常运行时间 32 天 21 小时 54 分 32 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\diag\tnslsnr\dbbostest\listener\alert\log.xml ---此处格式是xml格式的监听日志
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbbostest)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 3 个处理程序...
服务 "bostest" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
服务 "bostestXDB" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
若要变回老的方式,需在 listener.ora文件添加如下行DIAG_ADR_ENABLED_listener
= OFF 注意,红色部分是监听名,需替换实际的监听名字。
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 14:12:24
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
命令执行成功
C:\Documents and Settings\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 14:12:28
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 21-5月 -2015 16:04:08
正常运行时间 32 天 22 小时 8 分 28 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 D:\app\product\11.2.0\dbhome_1\network\log\listener.log
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbbostest)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "bostest" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
服务 "bostestXDB" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
How To Change the Listener Log Filename Without Stopping the Listener (文档 ID 135063.1)
监听的一些其他参数:
DIAG_ADR_ENABLED_LISTENER=OFF
DIAG_ADR_ENABLED_LISTENER_SCAN1=OFF
INBOUND_CONNECT_TIMEOUT_LISTENER = 110
INBOUND_CONNECT_TIMEOUT_LISTENER_SCAN1 = 110
1:首先停止监听服务进程(tnslsnr)记录日志。
lsnrctl set log_status off;
2:将监听日志文件(listener.log)复制一份,以listener.log.yyyymmdd格式命名
cp listener.log listener.log.20150622
3、将监听日志文件(listener.log)清空。清空文件的方法有很多
cat /dev/null > listener.log
4:开启监听服务进程(tnslsnr)记录日志
lsnrctl set log_status on;
对于这种listener.log增长非常迅速的系统,可以关闭监听日志lsnrctl set log_status off,不让监听写日志到文件。也可以写个job定期清理。
rq=` date +"%d" `
cp $ORACLE_HOME/network/log/listener.log $ORACLE_BACKUP/network/log/listener_$rq.log
su - oracle -c "lsnrctl set log_status off"
cp /dev/null $ORACLE_HOME/network/log/listener.log
su - oracle -c "lsnrctl set log_status on"
监听日志文件改变:
11g开始引入ADR,监听日志就从原来的$ORACLE_HOME/network/log/listener.log变为了$ORACLE_BASE/diag/tnslsnr/hostname/listener/alert/log.xml
Normally, log.xml will only reflect very recent data, and it won't get purged. However, as the log file grows, it
will be archived into a log_1.xml, log_2.xml and so on, and those files will get purged instead.
The "archived" log_1.xml, etc. will not show up until the log.xml file gets to 10MBytes.
$ORACLE_BASE/diag/tnslsnr/hostname/listener/alert 目录下的xml文件以每个10m的方式在不停增多,之前简单的只定期清理
$ORACLE_HOME/network/log/listenr.log变为还需多清理alert目录下的
C:\Documents and Settings\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 13:58:32
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 21-5月 -2015 16:04:08
正常运行时间 32 天 21 小时 54 分 32 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 d:\app\diag\tnslsnr\dbbostest\listener\alert\log.xml ---此处格式是xml格式的监听日志
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbbostest)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 3 个处理程序...
服务 "bostest" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
服务 "bostestXDB" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
若要变回老的方式,需在 listener.ora文件添加如下行DIAG_ADR_ENABLED_listener
= OFF 注意,红色部分是监听名,需替换实际的监听名字。
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 14:12:24
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
命令执行成功
C:\Documents and Settings\Administrator>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-6月 -2015 14:12:28
Copyright (c) 1991, 2010, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbbostest)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
启动日期 21-5月 -2015 16:04:08
正常运行时间 32 天 22 小时 8 分 28 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 D:\app\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 D:\app\product\11.2.0\dbhome_1\network\log\listener.log
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbbostest)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "bostest" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
服务 "bostestXDB" 包含 1 个实例。
实例 "bostest", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
How To Change the Listener Log Filename Without Stopping the Listener (文档 ID 135063.1)
监听的一些其他参数:
DIAG_ADR_ENABLED_LISTENER=OFF
DIAG_ADR_ENABLED_LISTENER_SCAN1=OFF
INBOUND_CONNECT_TIMEOUT_LISTENER = 110
INBOUND_CONNECT_TIMEOUT_LISTENER_SCAN1 = 110
相关文章推荐
- iptables 无法启动
- BROWSEINFO的结构介绍之获取文件(夹)路径
- 黑马程序员--C基础--数组
- jackson json字符串、map、java对象的转换例子
- 配置freeglut和glew
- 用纯CSS实现照片墙
- wix 快速安装
- Hibernate单表操作(六)——查询记录get()与load()方法区别
- 基于ExtJs的桌面系统(1)
- 【转】用户空间使用i2c_dev--不错
- wap页面中手机号码处理总结
- Win10设置任务栏位置图标以保护我们的隐私
- linux下安装PHP扩展
- iOS 基础
- iOS 9适配系列教程:后台定位
- Info.plist Utility Error: “Info.plist couldn't be opened because there is no such file”
- sql server 2008 性能优化
- 涨停板联盟6月26日分享。
- javascript 字符串相关知识汇总
- JavaWeb 服务启动时,在后台启动加载一个线程