删除或重命名 listener.log 文件的方法(转)

删除或重命名 listener.log 文件的方法(转)

As the listener.log file grows, the DBA will want to either remove or rename this log file. If you have ever tried to remove or rename the listener.log file on Windows while the TNS listener process was running you will quickly notice that Windows holds a lock on this file and returns an error:

C:> del C:oracleora92networkloglistener.log
C:oracleora92networkloglistener.log
The process cannot access the file because it is being used by another process.

Most DBAs simply stop the TNS listener process, rename (or remove) the file, then restart the TNS listener process. This can, however, cause potention connection errors for users that are attempting to connect while the listener process is down.

Even under UNIX, problems exist when attempting to rename the listener.log file while the TNS listener process is running. Just like under Windows, the Oracle TNS listener process holds an open handle to the file. Under UNIX, you CAN remove the file, but Oracle will not re-create the file when it attempts to write to it again. The TNS listener will need to be stopped and restarted in order for it to create the new listener.log file.

Well, here is a solution for renaming (or removing) the listener.log file without having to stop and start the TNS listener process under either Windows or UNIX:

[@more@] Windows:
C:> cd oracleora92networklog
C:oracleora92networklog> lsnrctl set log_status off
C:oracleora92networklog> rename listener.log listener.old
C:oracleora92networklog> lsnrctl set log_status on

UNIX:

% cd /u01/app/oracle/product/9.2.0/network/log
% lsnrctl set log_status off
% mv listener.log listener.old
% lsnrctl set log_status on

from http://www.idevelopment.info/data/Oracle/DBA_tips/Networking/NET_3.shtml

--End--

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

转载于:http://blog.itpub.net/14663377/viewspace-1035706/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值