一 监听跟踪日志清理
1.集群清理:
注意:集群中listener_scan1.log清理方式有所不同
lsnrctl命令行模式
set current_listener listener_scan1
set log_status off
cat /dev/null > listener_scan1.log
set log_status on
cat listener_scan1.log

2.具体步骤:
具体如下:
10.0.3.194:
[oracle@otmdb1 ~]$ cd /oracle/grid/grid_home/log/diag/tnslsnr/otmdb1/listener_scan1/trace
[oracle@otmdb1 trace]$ ll
total 7924660
-rw-r----- 1 grid oinstall 8112959097 Feb 25 09:36 listener_scan1.log
[oracle@otmdb1 trace]$ du -h listener_scan1.log 
7.6G    listener_scan1.log
[oracle@otmdb1 trace]$ exit
logout
[root@otmdb1 ~]# su - grid
[grid@otmdb1 ~]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-FEB-2019 09:39:07

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> set current_listener listener_scan1
Current Listener is listener_scan1
LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
listener_scan1 parameter "log_status" set to OFF
The command completed successfully

打开另一个shell:
[root@otmdb1 trace]# cat /dev/null > listener_scan1.log
[root@otmdb1 trace]# ll
total 8
-rw-r----- 1 grid oinstall 5656 Feb 25 09:40 listener_scan1.log

还在本来的shell:
LSNRCTL> set log_status on
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
listener_scan1 parameter "log_status" set to ON
The command completed successfully
LSNRCTL> 

10.0.3.195:
[oracle@otmdb2 ~]$ cd /oracle/grid/grid_home/log/diag/tnslsnr/otmdb2/listener_scan1/trace
[root@otmdb2 trace]# ll -h
total 14M
-rw-r----- 1 grid oinstall 14M Jan  1 17:05 listener_scan1.log
-rw-r----- 1 grid oinstall   0 Apr 19  2018 ora_14935_140093840803584.trc
[root@otmdb2 trace]# pwd
/oracle/grid/grid_home/log/diag/tnslsnr/otmdb2/listener_scan1/trace

日志很小,暂时不用清理


[root@otmdb2 ~]# su - grid
[grid@otmdb2 ~]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-FEB-2019 09:45:29

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> set current_listener listener_scan1
Current Listener is listener_scan1
LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
   
   
二 监听报警日志清理
10.0.3.194
1
mkdir /dbbak/listen_log_bak

2
cd /oracle/grid/grid_home/log/diag/tnslsnr/otmdb1/listener_scan1/alert
cp log_*.xml /dbbak/listen_log_bak/
rm -f log_*.xml

[root@otmdb1 oracle]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/mpathap7   61G   27G   31G  47% /
tmpfs                  95G  441M   95G   1% /dev/shm
/dev/mapper/mpathap1  194M   50M  135M  27% /boot
/dev/mapper/mpathap6  9.7G  249M  8.9G   3% /opt
/dev/mapper/mpathap3   77G   48G   26G  66% /oracle
10.0.3.134:/vol/db    1.8T  541G  1.3T  31% /dbbak
You have mail in /var/spool/mail/root

10.0.3.195:
mkdir /bk03/listen_log_bak
cd /oracle/grid/grid_home/log/diag/tnslsnr/otmdb2/listener_scan1/alert
cp log_*.xml /bk03/listen_log_bak/
rm -f log_*.xml