MOS文档:
purgeLogs: Cleanup traces, logs in one command (Doc ID 2081655.1)
Why Are My Listener Logs & Traces Not Purged By The ADR (文档 ID 1438242.1)
1、安装
[root@db1 opt]# rpm -ivh purgelogs-2.0.1-6.el7.x86_64.rpm
warning: purgelogs-2.0.1-6.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 46caeffa: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:purgelogs-2.0.1-6 ################################# [100%]
purgelogs-2.0.1.6 binary has been installed on /opt/purgelogs succesfully!
2、操作
[root@db1 ~]# /opt/purgelogs/purgelogs.bin cleanup -help
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
purgeLogs - Archive & Cleanup GI/RDBMS logs and traces
Version: 2.0.1-6
Copyright (c) 2015-2023 Oracle and/or its affiliates.
--------------------------------------------------------
Author: Ruggero Citton
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
Usage:
purgelogs.bin cleanup [--days
[--orcl
[--tfa
[--osw
[--oda
[--extra '
[--automigrate]
[--dryrun]
purgeLogs cleanup OPTIONS
--days
--orcl
--tfa
--osw
--oda
--extra '
--aud Purge Audit logs based on '-orcl
--lsnr It will force the cleanup of listeners log independently by the age
--automigrate It will run the adrci schema migrate commands in case of DIA-49803
--dryrun It will show the purge commands w/o execute them
--help Display this help and exit
[root@db1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 126G 0 126G 0% /dev
tmpfs 126G 2.2G 124G 2% /dev/shm
tmpfs 126G 131M 126G 1% /run
tmpfs 126G 0 126G 0% /sys/fs/cgroup
/dev/mapper/ol-root 230G 16G 215G 7% /
/dev/sda4 152G 150G 2G 99% /u01
/dev/sda2 494M 159M 336M 33% /boot
/dev/sda1 500M 9.8M 490M 2% /boot/efi
tmpfs 26G 12K 26G 1% /run/user/42
tmpfs 26G 0 26G 0% /run/user/1000
tmpfs 26G 0 26G 0% /run/user/0
[root@db1 ~]# /opt/purgelogs/purgelogs.bin cleanup -orcl 15 -aud 1 -lsnr 1 --本机上执行
INFO: 2023-08-21 12:55:41: Please check the logfile '/opt/purgelogs/out/log/purgeLogs_238621.log' for more details
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
purgeLogs - Archive & Cleanup GI/RDBMS logs and traces
Version: 2.0.1-6
Copyright (c) 2015-2023 Oracle and/or its affiliates.
--------------------------------------------------------
Author: Ruggero Citton
RAC Pack, Cloud Innovation and Solution Engineering Team
...........................
...........................
[root@db1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 126G 0 126G 0% /dev
tmpfs 126G 2.2G 124G 2% /dev/shm
tmpfs 126G 131M 126G 1% /run
tmpfs 126G 0 126G 0% /sys/fs/cgroup
/dev/mapper/ol-root 230G 16G 215G 7% /
/dev/sda4 152G 33G 119G 22% /u01
/dev/sda2 494M 159M 336M 33% /boot
/dev/sda1 500M 9.8M 490M 2% /boot/efi
tmpfs 26G 12K 26G 1% /run/user/42
tmpfs 26G 0 26G 0% /run/user/1000
tmpfs 26G 0 26G 0% /run/user/0
[root@db1 ~]#
[root@db1 ~]# tfactl managelogs -purge -older 4h -dryrun ---2个节点都删除
.-----------------------------------------------------------------------------------.
| File System Variation for ADR Path: /u01/app/grid |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| State | Name | Size | Used | Free | Capacity | Mount |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| Before | /dev/mapper/ol-u01 | 209612800 | 28045060 | 181567740 | 14% | /u01 |
| After | /dev/mapper/ol-u01 | 209612800 | 28045060 | 181567740 | 14% | /u01 |
'--------+--------------------+-----------+----------+-----------+----------+-------'
2023-08-23 10:15:39: INFO Diagnostic Destination "/u01/app/oracle/diag/rdbms/orcl/orcl1" will Be Purged
2023-08-23 10:15:39: MESSAGE Diagnostic Destinations for Database Home(s) Purged: - 0 files deleted , 0 bytes space recovered
2023-08-23 10:15:39: MESSAGE Calculating Filesystem Before/After Sizes...
==== Database Home(s) ADR Filesystem(s) Size Summary ====
.-----------------------------------------------------------------------------------.
| File System Variation for ADR Path: /u01/app/oracle |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| State | Name | Size | Used | Free | Capacity | Mount |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| Before | /dev/mapper/ol-u01 | 209612800 | 28045064 | 181567736 | 14% | /u01 |
| After | /dev/mapper/ol-u01 | 209612800 | 28046112 | 181566688 | 14% | /u01 |
'--------+--------------------+-----------+----------+-----------+----------+-------'
Output from host : db2
------------------------------
2023-08-23 10:15:43: INFO Estimating files older than 30 days
2023-08-23 10:15:43: INFO Space is calculated in bytes [without round off]
2023-08-23 10:15:43: INFO Performing Dry Run of Purge for Grid Infrastructure ADR Destinations
2023-08-23 10:15:43: INFO Diagnostic Destination "/u01/app/grid/diag/crs/db2/crs" will Be Purged
2023-08-23 10:15:43: INFO Diagnostic Destination "/u01/app/grid/diag/asm/+asm/+ASM2" will Be Purged
2023-08-23 10:15:43: INFO Diagnostic Destination "/u01/app/grid/diag/tnslsnr/db2/asmnet1lsnr_asm" will Be Purged
2023-08-23 10:15:43: INFO Diagnostic Destination "/u01/app/grid/diag/tnslsnr/db2/listener" will Be Purged
2023-08-23 10:15:43: MESSAGE Diagnostic Destinations for GI Home Purged: - 0 files deleted , 0 bytes space recovered
2023-08-23 10:15:43: MESSAGE Calculating Filesystem Before/After Sizes...
==== Grid Infrastructure ADR Filesystem(s) Size Summary ====
.-----------------------------------------------------------------------------------.
| File System Variation for ADR Path: /u01/app/grid |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| State | Name | Size | Used | Free | Capacity | Mount |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| Before | /dev/mapper/ol-u01 | 209612800 | 37550984 | 172061816 | 18% | /u01 |
| After | /dev/mapper/ol-u01 | 209612800 | 37550984 | 172061816 | 18% | /u01 |
'--------+--------------------+-----------+----------+-----------+----------+-------'
2023-08-23 10:15:44: INFO Diagnostic Destination "/u01/app/oracle/diag/rdbms/orcl/orcl2" will Be Purged
2023-08-23 10:15:44: MESSAGE Diagnostic Destinations for Database Home(s) Purged: - 0 files deleted , 0 bytes space recovered
2023-08-23 10:15:44: MESSAGE Calculating Filesystem Before/After Sizes...
==== Database Home(s) ADR Filesystem(s) Size Summary ====
.-----------------------------------------------------------------------------------.
| File System Variation for ADR Path: /u01/app/oracle |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| State | Name | Size | Used | Free | Capacity | Mount |
+--------+--------------------+-----------+----------+-----------+----------+-------+
| Before | /dev/mapper/ol-u01 | 209612800 | 37550988 | 172061812 | 18% | /u01 |
| After | /dev/mapper/ol-u01 | 209612800 | 37550988 | 172061812 | 18% | /u01 |
'--------+--------------------+-----------+----------+-----------+----------+-------'
[root@db1 ~]#
[root@db1 ~]# tfactl print config|grep manageLogsAutoPurge
| Managelogs Auto Purge ( manageLogsAutoPurge ) | OFF |
| Time interval between consecutive Managelogs Auto Purge(minutes) ( manageLogsAutoPurgeInterval ) | 60 |
| Logs older than the time period will be auto purged(days[d]|hours[h]) ( manageLogsAutoPurgePolicyAge ) | 30d |
[root@db1 ~]#
[root@db1 ~]# tfactl set manageLogsAutoPurge=ON