当前位置: 首页 > Oracle, oracle 10g, oracle 11g > 正文

Oracle 如何关闭监听日志

前段时间,一套小型生产数据库,由于使用很多短连接,并且连接相当频繁,监听日志文件占用了大量的磁盘空间。检查日志内容,发现都是正常的连接,那么在不需要分析监听日志的情况下,可以直接关闭监听的日志输出,如果在需要通过监听日志来分析故障或解决问题时,再打开监听日志的输出。

以下是默认情况下,监听的状态信息,以下信息来自测试数据库。

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SL010A-IVADT2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-MAY-2016 10:40:47
Uptime                    102 days 23 hr. 13 min. 28 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/SL010A-IVADT2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SL010A-IVADT2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ivldb" has 1 instance(s).
  Instance "ivldb", status READY, has 1 handler(s) for this service...
Service "ivldbXDB" has 1 instance(s).
  Instance "ivldb", status READY, has 1 handler(s) for this service...
Service "ivlifdb" has 1 instance(s).
  Instance "ivlifdb", status READY, has 1 handler(s) for this service...
Service "ivlifdbXDB" has 1 instance(s).
  Instance "ivlifdb", status READY, has 1 handler(s) for this service...
The command completed successfully

监听日志受log_status参数控制,ON为开打,这也是默认值,OFF为关闭。可以通过LSNRCTL工具的show命令来查看参数的状态。

[oracle@SL010A-IVADT2 ~]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-SEP-2016 10:08:15

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SL010A-IVADT2)(PORT=1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully

当前log_status参数为开启状态,通过set命令将之关闭。

LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SL010A-IVADT2)(PORT=1521)))
LISTENER parameter "log_status" set to OFF
The command completed successfully

此时再次查询监听状态将会发现Listener Log File这行将不在显示。

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SL010A-IVADT2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-MAY-2016 10:40:47
Uptime                    102 days 23 hr. 27 min. 37 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SL010A-IVADT2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ivldb" has 1 instance(s).
  Instance "ivldb", status READY, has 1 handler(s) for this service...
Service "ivldbXDB" has 1 instance(s).
  Instance "ivldb", status READY, has 1 handler(s) for this service...
Service "ivlifdb" has 1 instance(s).
  Instance "ivlifdb", status READY, has 1 handler(s) for this service...
Service "ivlifdbXDB" has 1 instance(s).
  Instance "ivlifdb", status READY, has 1 handler(s) for this service...
The command completed successfully

此时,再有新的连接,将不会记录到监听日志文件。

本文固定链接: https://www.dbdream.com.cn/2016/10/oracle-%e5%a6%82%e4%bd%95%e5%85%b3%e9%97%ad%e7%9b%91%e5%90%ac%e6%97%a5%e5%bf%97/ | 信春哥,系统稳,闭眼上线不回滚!

该日志由 dbdream 于2016年10月13日发表在 Oracle, oracle 10g, oracle 11g 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: Oracle 如何关闭监听日志 | 信春哥,系统稳,闭眼上线不回滚!
关键字: , , ,

Oracle 如何关闭监听日志:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter