Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle11g listener log listener.log file is too large

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The snooping log and warning log of oracle 11g are in the / opt/oracle/app/diag/tnslsnr/ machine name / listener directory

The warning log is in the alert directory, and the listening log is in the trace directory. The log files generated under the listener directory are relatively large and are the main objects to be cleaned. The listening log in the listener directory is a file called listener.log, while the warning log log.xml, which is divided into a log_XXXX.xml log every 11m or so, gradually accumulates.

Is there no need to truncate and maintain the monitoring log files? The answer is no. Of course, the monitoring log files (listener.log) should be cleaned regularly. If you do not clean up regularly, you will encounter the following problems:

1. Snooping log files (listener.log) are getting larger and larger, taking up extra storage space. (of course, there is no shortage of space for storing cabbage prices now. But we still have to keep improving in the spirit of craftsmen.

2. Listening log files (listener.log) become too large to cause some problems: the size of LISTENER.LOG logs cannot exceed 2GB, which will cause LISTENER listeners to fail to handle new connections.

3. The monitoring log file (listener.log) becomes too large, which brings some performance problems and troubles to writing and viewing.

1. Stand-alone example:

$find $ORACLE_BASE-name listener.log

/ opt/oracle/app/diag/tnslsnr/testdb/listener/trace/listener.log

LSNRCTL > showThe following operations are available after showAn asterisk (*) denotes a modifier or extended command:rawmode displaymode rules trc_file trc_directory trc_level log_file Log_directory log_status current_listener inbound_connect_timeout startup_waittime snmp_visible save_config_on_stop dynamic_registration enable_global_dynamic_endpoint oracle_home Pid LSNRCTL > show log_fileConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521) LISTENER parameter "log_file" set to / opt/oracle/app/diag/tnslsnr/testdb/listener/alert/log.xmlThe command completed successfullyshow log_statusConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521) LISTENER parameter "log_status" set to ONThe command completed successfullyshow log_directoryConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521)) LISTENER parameter "log_directory" set to / opt/ Oracle/app/diag/tnslsnr/testdb/listener/alertThe command completed successfully

Monitoring is currently in a normal state, and the log function is also turned on. Later, it turns out that the log file size is full.

Deal with:

1: stop the log first

LSNRCTL > set log_status offConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521)) LISTENER parameter "log_status" set to OFFThe command completed successfullyLSNRCTL > exit

2. Go to the directory / opt/oracle/app/diag/tnslsnr/wskjdb/listener/trace

Mv listener.log listener.log.bak

3. Open the log

LSNRCTL > set log_status onConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521)) LISTENER parameter "log_status" set to ONThe command completed successfully

4. Reload the listener

LSNRCTL > reloadConnecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521)) The command completed successfullyLSNRCTL > exitLSNRCTL > show log_status Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=xxxxxx) (PORT=1521)) LISTENER parameter "log_status" set to ONThe command completed successfully

5. Regenerate the new log under the directory, compress and save it

$tar czvf listener.log.bak.gz listener.log.bak

6. Delete the original log:

Rm-rf listener.log.bak

2. In RAC environment, you need to switch to grid users to query listening logs.

# su-grid

Lsnrctl command line mode

Set current_listener listener_scan1set log_status offcat / dev/null > listener_scan1.logset log_status oncat listener_scan1.log

Third, clean up regularly by using crontab:

Using a timer to clean up the listening log file is similar to the above, and the script is as follows:

$listenerroomlog.shrunken _ name = `date +'% d% m'`cd / opt/oracle/app/diag/tnslsnr/wskjdb/listener/tracelsnrctl set log_status offmv listener.log / tmp/listener.log.$data_namelsnrctl set log_status onlsnrctl reload

Develop crontab tasks:

0 1 * / home/oracle/listener_log.sh > / home/oracle/listener_log.log 2 > & 1

Execution time and retention policy can be self-made, through the crontab can get rid of manual operations, through the system to automatically perform maintenance operations.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report