Oracle log file reaches 4G

Solution 1: Stop the listener

1) LSNRCTL enters interactive mode cmd input LSNRCTL
2) Execute set current_listener LISTENER
3) set log_status off
4) stop stop the listener
5) Manually delete the listener.log file in the listening log path specified by
ADR6 ) start restarting the listener
7) status to view the status


Solution 2: The script periodically clears the log file


@echo off
rem FileSize specifies in KB how large the log file is to be truncated, the default is 2GB
rem FileBakName specifies the name of the log file for backup, Full path cannot be used!
rem FileBak backup log file name, you need to specify the full path!
rem FileName The log file to be truncated, the full path needs to be specified!

set /a FileSize=2*1024*1024
set FileBakName="alter.log.bak"
set FileBak="D:\Working Documents\temp\alter.log.bak"
set FileName="D:\Working Documents\temp\ alter.log"
if exist %FileName% (
for %%i in (%FileName%) do (
  set /a CurrentSize=%%~zi/1024
  if %CurrentSize% gtr %FileSize% (
    if exist %FileBak% (
      del %FileBak%
    )
    ren %FileName% %FileBakName%
  )
)
)

is very primitive, only one log file can be monitored, and several parameters must be manually set, and finally added Just go to the scheduled tasks.
If this problem is under Linux, you can use the logrotate tool to solve it. logrotate is a tool that automatically archives log files on a periodic basis to avoid log files from being too large.


Under Windows, you can use the following command to control
cd E:\app\Administrator\diag\tnslsnr\NDEAM003\listener\trace


lsnrctl set log_status off
rename listener.log listener20170109.old
lsnrctl set log_status on

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326401409&siteId=291194637