oracle12c删除监听log_n.xml文件

1、问题描述:

现场有个数据库,log_n.xml日志文件太多了。

oracle12c删除监听log_n.xml文件_第1张图片

2、要处理这个问题,我们需要了解下 这是什么文件

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=446908702867004&parent=EXTERNAL_SEARCH&sourceId=HOWTO&id=1438242.1&_afrWindowMode=0&_adf.ctrl-state=16n1ijzfnt_4

在oracle mos上有这个说明

(1) Listener log files ('xml' files) are not purged via the 'automatic' purge mechanism.

The automatic purge for the listener 'xml' files is a known issue that has been reported several times. For that, two enhancement requests have been raised:

Unpublished Bug 9576112  - AUTOMATIC PURGE OF 11G LISTENER LOGS LOG_NNN.XML
Unpublished Bug 13090278 - PURGING IS NOT HAPPENING FOR LISTENER ALERT AND TRACE FILES. The unpublished ER has been implemented in 19c.

It will not work basically due to the fact that is something not yet implemented in the net layer.

(2) Normally the log.xml file stores the most recent information and, as the log file grows, it will be archived into a log_1.xml, log_2.xml ..., with 10MB size each one.

(3) The manual purge -age command actually removes the listener xml files (log_n.xml files) who's last record is at least "-age " old.

But the information within a listener log file is not purged, so, if the least record in any of the existing log_n.xml files is more recent than the indicated age, all the information within the file will be kept, as shown in the last show alert command.  Even if this information is older than the indicated age.  For example, if you execute a purge -age 0 command, and trace it with strace, e.g.:

   strace -o /tmp/strace.trc -fae adrci exec="set home ;purge -age 0"

you will see that all the existing log_n.xml files are removed at OS level (including the log.xml file):

   11964 unlink("//alert/log.xml") = 0

Then, given that the listener is working, a new log file is automatically created, including all the information generated since the age -0 command.  The next show alert command will show you information since the purge command was executed.

Note: This behaviour applies to DB Alert log files too, but, given the autopurge works with them, it is less relevant.

Therefore in 11g & 12c releases, these log files (and trace files) will not get automatically purged and so you need to manually delete them when they are no longer required.

Starting with 19c release the feature of purging is implemented (through enhancement request 13090278). The relevant parameters for listener are the following:

LOG_FILE_NUM_listener_name:
    The LOG_FILE_NUM_listener_name is a diagnostic parameter of the listener.ora file that specifies the number of log file segments.
https://docs.oracle.com/en/database/oracle/oracle-database/19/netrf/oracle-net-listener-parameters-in-listener-ora.html#GUID-812F2A7E-A31C-4581-804F-A4AE692C960D

LOG_FILE_SIZE_listener_name:
    The LOG_FILE_SIZE_listener_name diagnostic parameter of the listener.ora file specifies the size of each log file segment.
https://docs.oracle.com/en/database/oracle/oracle-database/19/netrf/oracle-net-listener-parameters-in-listener-ora.html#GUID-FF94A234-A29C-46AA-8770-4CA1BFB5C27C

就是19c之前的版本没有自动清理功能,可以通过

# su - oracle

$ adrci

adrci> help purge

adrci> purge -age 1440

这样可以清理掉一天以前的日志文件,1440的单位是分钟。

你可能感兴趣的:(oracle,12c,adrci)