随着时间和连接,Oracle的listener.log会不断增长,这时就需要我们对其进行处理。若试图直接在listener启动时直接删除,可能会收到报错信息类似:The process cannot access the file because it is being used by another process。若直接停掉监听再删除,对于生产库,这基本是不被允许的操作,在Unix下面当然可以rm,但这个文件不会被自动重新创建。
正确方法:
cd $ORACLE_HOME/network/log
关闭日志记录:
lsnrctl set log_status off
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2010 10:35:57
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521)))
LISTENER parameter "log_status" set to OFF
The command completed successfully
移动监听日志到另一个地方:
mv listener.log listener.bak
然后打开日志记录:
lsnrctl set log_status on
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2010 10:37:13
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521)))
LISTENER parameter "log_status" set to ON
The command completed successfully
注意:listener.log如果写爆了listener就会挂掉用不了,所以对于连接很多的数据库要定期检查这个log。