当前位置: 首页 > LISTENER > 正文

11G关于监听文件位置与监听文件大小限制

昨晚群里一个兄弟问他们一体机环境,监听日志文件没有写到XML文件,并且listener.log中也没有写日志文件。

监听状态如下:

部分敏感信息已经被替换

[grid@www.htz.pw ~]$ lsnrctl status

 

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 03-SEP-2014 02:13:18

 

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))

STATUS of the LISTENER

————————

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                18-JUL-2014 01:11:23

Uptime                    47 days 1 hr. 1 min. 54 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/network/log/listener.log

这里可以看到监听日志位置到$ORACLE_HOME/network/log位置,而非adr目录,并且listener.log修改时候是在6月份。

111G监听文件位置

11G环境中,监听文件默认存放在adr目录中,并且存放2份,一份xml格式,一份文本格式,如下:

xml位置

[oracle@www.htz.pw sql]$lsnrctl status|grep "Log File"

Listener Log File         /oracle/app/oracle/diag/tnslsnr/orcl9i/listener/alert/log.xml

文件格式位置

[oracle@www.htz.pw sql]$ls -l $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log

-rw-r—–  1 oracle oinstall 1973762 Sep  3 06:22 /oracle/app/oracle/diag/tnslsnr/orcl9i/listener/trace/listener.log

1.1 禁用监听日志的adr功能

[oracle@www.htz.pw sql]$ps -ef|grep lsn

oracle    5165  7845  0 06:18 ?        00:00:00 /oracle/app/oracle/product/11.2.0/db_1123/bin/tnslsnr LISTENER -inherit

oracle    5166  7845  0 06:18 ?        00:00:00 /oracle/app/oracle/product/11.2.0/db_1123/bin/tnslsnr LISTENER -inherit

oracle    6400 32690  0 06:27 pts/1    00:00:00 grep lsn

oracle    7844     1  0 03:00 ?        00:00:00 /oracle/app/oracle/product/11.2.0/db_1123/bin/tnslsnr LISTENER -inherit

oracle    7845  7844  0 03:00 ?        00:00:00 /oracle/app/oracle/product/11.2.0/db_1123/bin/tnslsnr LISTENER -inherit

[oracle@www.htz.pw sql]$echo "DIAG_ADR_ENABLED_LISTENER=off">>$ORACLE_HOME/network/admin/listener.ora

[oracle@www.htz.pw sql]$tail -f !$

tail -f $ORACLE_HOME/network/admin/listener.ora

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = orcl9i)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )

 

ADR_BASE_LISTENER = /oracle/app/oracle

 

DIAG_ADR_ENABLED_LISTENER=off

再次加载监听

[oracle@www.htz.pw sql]$lsnrctl reload

 

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 03-SEP-2014 06:29:54

 

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl9i)(PORT=1521)))

The command completed successfully

[oracle@www.htz.pw sql]$lsnrctl status|grep "Log File"

Listener Log File         /oracle/app/oracle/product/11.2.0/db_1123/network/log/listener.log

看到监听日志文件路径已经回到10G的默认的方式,存放$ORACLE_HOME/network/admin/log下面

1.2 修改监听日志文件名与路径

有时由于空间原因,需要修改监听日志文件名与路径的位置,下面将日志文件路径名修改到/tmp,文件名修改为www.htz.pw,文件名自动增加.log结尾

增加参数到listener.ora

[oracle@www.htz.pw sql]$echo "LOG_DIRECTORY_LISTENER=/tmp">>$ORACLE_HOME/network/admin/listener.ora

[oracle@www.htz.pw sql]$echo "LOG_FILE_LISTENER=www.htz.pw">>$ORACLE_HOME/network/admin/listener.ora

[oracle@www.htz.pw sql]$cat !$

cat $ORACLE_HOME/network/admin/listener.ora

# listener.ora Network Configuration File: /oracle/app/oracle/product/11.2.0/db_1123/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = orcl9i)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )

 

ADR_BASE_LISTENER = /oracle/app/oracle

 

DIAG_ADR_ENABLED_LISTENER=off

LOG_DIRECTORY_LISTENER=/tmp

LOG_FILE_LISTENER=www.htz.pw

重新加载监听

[oracle@www.htz.pw sql]$lsnrctl reload

 

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 03-SEP-2014 06:33:42

 

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl9i)(PORT=1521)))

The command completed successfully

查看监听的状态

[oracle@www.htz.pw sql]$lsnrctl status

 

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 03-SEP-2014 06:33:50

 

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl9i)(PORT=1521)))

STATUS of the LISTENER

————————

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                03-SEP-2014 03:00:20

Uptime                    0 days 3 hr. 33 min. 29 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/app/oracle/product/11.2.0/db_1123/network/admin/listener.ora

Listener Log File         /tmp/www.htz.pw.log

Listening Endpoints Summary…

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=orcl9i)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service "orcl1123" has 1 instance(s).

  Instance "orcl1123", status READY, has 1 handler(s) for this service…

Service "orcl1123XDB" has 1 instance(s).

  Instance "orcl1123", status READY, has 1 handler(s) for this service…

The command completed successfully

这里看到监听文件名与路径都已经修改了

2 监听日志文件中无新日志生成

通过监听登陆数据库,都会向监听日志文件写日志,并且使用动态监听,pmon进程会将动态注册的信息写到监听日志文件中去。常常遇到监听日志文件中无新内容,一般情况下是:

1,日志文件达到4G,部分OS达到4G后,不会向监听日志文件写新的内容。

2,无新连接,可以通过lsnrctl service来查看

在这位兄弟的情况就是日志达到4G的大小

[grid@www.htz.pw ~]$ ls -l /u01/app/grid/network/log/listener.log

-rw-r—– 1 grid oinstall 4294967366 Aug  6 16:37 /u01/app/grid/network/log/listener.log

3 清理日志文件

[oracle@www.htz.pw tmp]$lsnrctl

 

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 03-SEP-2014 06:54:47

 

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

 

Welcome to LSNRCTL, type "help" for information.

 

LSNRCTL> set current_listener listener

Current Listener is listener

LSNRCTL> set log_status off

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl9i)(PORT=1521)))

listener parameter "log_status" set to OFF

The command completed successfully

[oracle@www.htz.pw tmp]$> www.htz.pw.log

LSNRCTL> set log_status on

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl9i)(PORT=1521)))

listener parameter "log_status" set to ON

The command completed successfully

测试结束

本文固定链接: http://www.htz.pw/2014/09/03/11g%e5%85%b3%e4%ba%8e%e7%9b%91%e5%90%ac%e6%96%87%e4%bb%b6%e4%bd%8d%e7%bd%ae%e4%b8%8e%e7%9b%91%e5%90%ac%e6%96%87%e4%bb%b6%e5%a4%a7%e5%b0%8f%e9%99%90%e5%88%b6.html | 认真就输

该日志由 huangtingzhong 于2014年09月03日发表在 LISTENER 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 11G关于监听文件位置与监听文件大小限制 | 认真就输
关键字: , , ,