New function of oracle19c — automatic rotation of listener log in TXT format

Time:2021-7-30

In versions before 19C, the TXT format listener log of Oracle database cannot be automatically managed circularly(Mos 1744876.1), which has caused a great burden to users.

19c, the following two parameters are imported:

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

#### 7.5.3 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.

Purpose
To specify the number of log file segments. At any point of time there can be only n log file segments where n is LOG_FILE_NUM_listener_name. If the log grows beyond this number, then the older segments are deleted.

Default
No default. If you don't specify a value, or set the value to zero, then the number of segments grows indefinitely.

Values
Any integer value.

Example 7-9
LOG_FILE_NUM_listener=3

#### 7.5.4 LOG_FILE_SIZE_listener_name

The LOG_FILE_SIZE_listener_name diagnostic parameter of thelistener.ora file specifies the size of each log file segment.

Purpose
To specify the size of each log file segment. The size is in MB.

Default
300 MB

Values
Any integer value.

Example 7-10 Example
LOG_FILE_SIZE_listener=10

Through the above parameters, the listener log in TXT format can be managed automatically as the listener log in XML format.

Example:

[[email protected] ~]$ lsnrctl start
Lsnrctl for Linux: version 19.0.0.0 - production on January 20 - 2021 17:33:16
Copyright (c) 1991, 2019, Oracle.  All rights reserved.
/u01/app/oracle/product/19.3.0/dbhome_ 1 / bin / tnslsnr "start" and "start". Wait, wait, wait
TNSLSNR for Linux: Version 19.0.0.0.0 - Production
システム・パラメータ・ファイルは/u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.oraです。
The user interface of the user interface is / u01 / APP / Oracle / diag / tnslsnr / db1903 / listener / Alert / log.xml.
リスニングしています: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1903)(PORT=1521)))
リスニングしています: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(description = (address = (protocol = TCP) (host = db1903) (Port = 1521)))
リスナーのステータス

------------------------

alias                         LISTENER
バージョン                TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start date                      20-january-2021 17:33:19
Harvest time                    0 day 0 time 0 minute 0 second
トレース・レベル          off
セキュリティ              ON: Local OS Authentication
SNMP                      OFF
パラメータ・ファイル      /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
ログ・ファイル            /u01/app/oracle/diag/tnslsnr/db1903/listener/alert/log.xml

リスニング・エンドポイントのサマリー...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1903)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
リスナーはサービスをサポートしていません。

コ マ ン ド は normal に end し〚し.

At / u01 / APP / Oracle / product / 19.3.0/dbhome_ 1. Set the following two parameters in the / network / admin / listener.ora file.

LOG_FILE_NUM_LISTENER=8
LOG_FILE_SIZE_LISTENER=1

Restart listening.

[[email protected] ~]$ lsnrctl stop listener
[[email protected] ~]$ lsnrctl start listener

Test it.

$> vi connect.sh
#!/bin/bash
while ( true ); do
sqlplus -S -L test/[email protected]:1521/pdb << EOF
SELECT * FROM dual;
EXIT;
EOF
done

$> chmod +x connect.sh
$> ./connect.sh > /dev/null
$> ./connect.sh > /dev/null
$> ./connect.sh > /dev/null
$> ...

◆ TXT format listener log

[[email protected] trace]$ pwd
/u01/app/oracle/diag/tnslsnr/db1903/listener/trace
[[email protected] trace]$ ll
Total 720
-rw-r-----. 1 oracle oinstall    twelve thousand two hundred and fifty-one    January 20 17:59 listener.log
-rw-r-----. 1 oracle oinstall 482866    January 20 17:59 listener_ 1.log

◆ listener log in XML format

[[email protected] alert]$ pwd
/u01/app/oracle/diag/tnslsnr/db1903/listener/alert
[[email protected] alert]$ ll
Total 1416
-rw-r-----. 1 oracle oinstall       nine hundred and sixty-two    January 20 17:59 log.xml
-rw-r-----. 1 oracle oinstall 1048912    January 20 17:59 log_ 1.xml

Note that the size of the above XML listener is smaller than 1MB. The reason is that the log files in the two formats need to record the same connection records, and each connection record in TXT format uses less space than that in XML format.

In addition,LOG_FILE_SIZE_listenerThe default value of is 300MB, which means that even if this parameter is not set, the XML listener log will automatically rotate when it reaches 300MB.

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]