New in 19 : Oracle Network Log File Segmentation with LOG_FILE_NUM_listener_name and LOG_FILE_SIZE_listener_name

Photo by Chris Greenhow on Unsplash

I started off the new year by reading the Oracle Database 19c New Features Guide and I came across a very nice new feature : Oracle Network Log File Segmentation. It is now possible to specify a maximum file size for listener logs and a maximum number of files to keep. In previous versions, only log.xml was segmented in chunks of 10Mb, but not the plain text listener.log.

The Net Services Administrator’s Guide briefly describes this feature and the Database Net Services Reference gives a definition of 2 new parameters in listener.ora :

  • LOG_FILE_NUM_listener_name : 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.
  • LOG_FILE_SIZE_listener_name : To specify the size of each log file segment. The size is in MB.

Let’s run a quick test with a listener in version 19.4 :

# lsnrctl status listener

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-JAN-2020 21:55:44

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-JAN-2020 22:24:32
Uptime                    0 days 23 hr. 31 min. 11 sec
Trace Level               support
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19_4_0_0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn2/listener/alert/log.xml
[...]

Set those 2 parameters with arbitrary values :

LOG_FILE_NUM_LISTENER=8 
LOG_FILE_SIZE_LISTENER=1

Then restart the listener because a simple reload will not take these modifications into account :

# lsnrctl stop listener
# lsnrctl start listener

After running some load against the listener, check the state of the plain text log files :

# [ oracle@collabn2:/u01/app/oracle/diag/tnslsnr/collabn2/listener/trace [21:42:04] [19.4.0.0.0 [GRID] SID=GRID] 0 ] #
# ls -lh
total 1.2G
-rw-r-----. 1 oracle oinstall 576K Jan  2 20:51 listener_1.log
-rw-r-----. 1 oracle oinstall 556K Jan  2 21:09 listener_2.log
-rw-r-----. 1 oracle oinstall 537K Jan  2 21:16 listener_3.log
-rw-r-----. 1 oracle oinstall 594K Jan  2 21:21 listener_4.log
-rw-r-----. 1 oracle oinstall 594K Jan  2 21:25 listener_5.log
-rw-r-----. 1 oracle oinstall 595K Jan  2 21:28 listener_6.log
-rw-r-----. 1 oracle oinstall 595K Jan  2 21:32 listener_7.log
-rw-r-----. 1 oracle oinstall 595K Jan  2 21:35 listener_8.log
-rw-r-----. 1 oracle oinstall 209K Jan  2 21:42 listener.log

I do have a number of files as expected, but they are approximately half the size I imagined. I had no idea that actually, the parameter LOG_FILE_SIZE_listener_name rather defines the size of log_*.xml files :

# [ oracle@collabn2:/u01/app/oracle/diag/tnslsnr/collabn2/listener/trace [21:45:05] [19.4.0.0.0 [GRID] SID=GRID] 0 ] #
# ls -lh ../alert/
total 10M
drwxr-xr-x. 14 oracle oinstall 4.0K Aug 13 16:20 ..
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 20:51 log_1.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:09 log_2.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:16 log_3.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:21 log_4.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:25 log_5.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:28 log_6.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:32 log_7.xml
-rw-r-----.  1 oracle oinstall 1.1M Jan  2 21:35 log_8.xml
drwxr-xr-x.  2 oracle oinstall 4.0K Jan  2 21:35 .
-rw-r-----.  1 oracle oinstall 363K Jan  2 21:44 log.xml

And plain text listener_*.log files are then rotated accordingly.

I will keep this detail in mind when implementing this useful new feature.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s