Oracle listener log file (usually called listener. log) is a plain text file whose size keeps increasing. On a production Oracle Server, DBA checks the file daily, such as checking whether the listener has an abnormal stop, whether there is a malicious attack connection or not. When this file is very large, it may be slow to open and browse the file content. In this case, you may think of backing up the current log file, then create a new log file again. However, Oracle listeners cannot delete or rename the log file at runtime. Therefore, only the listener is stopped and renamed before the listener is started, A new listener log file will be automatically created at startup, but the client connection will be disconnected. This article introduces a way to rename the listener log file without stopping the listener.
On Windows:
C: \> cd \ oracle \ ora92 \ network \ log # Switch to the directory where the listener log file is located
C: \ oracle \ ora92 \ network \ log> lsnrctl set log_status off # temporarily offline the listener log File
C: \ oracle \ ora92 \ network \ log> rename listener. log listener. old # rename the log file and add the date
C: \ oracle \ ora92 \ network \ log> lsnrctl set log_status on # Bring the listener log file online and a new log file will be created automatically.
On Linux/Unix platforms:
% 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
After the name is renamed, you can copy listener. old to the DBA's work computer for in-depth analysis. In case of hacker attacks, you can also retain the file as evidence.