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 <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
Usage:
purgelogs.bin cleanup [--days <days> [--aud] [--lsnr]] |
[--orcl <days> [--aud] [--lsnr]] |
[--tfa <days>] |
[--osw <days>] |
[--oda <days>] |
[--extra '<folder>':<days> | [, '<folder>':<days>]]
[--automigrate]
[--dryrun]
purgeLogs cleanup OPTIONS
--days <days> Purge orcl,tfa,osw,oda components logs & traces older then # days
--orcl <days> Purge only GI/RDBMS logs & traces (Default 30 days)
--tfa <days> Purge only TFA repository older then # days (Default 30 days)
--osw <days> Purge only OSW archives older then # days (Default 30 days)
--oda <days> Purge only ODA logs and trace older then # days (Default 30 days)
--extra '<folder>':<days> Purge only files in user specified folders (Default 30 days)
--aud Purge Audit logs based on '-orcl <days>' option
--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 <ruggero.citton@oracle.com>
RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
INFO: 2023-08-21 12:55:41: GI Audit logs purge started
INFO: 2023-08-21 12:55:41: ... purging GI Audit logs under '/u01/app/19.0.0/grid/rdbms/audit' older then 15 days
INFO: 2023-08-21 12:55:56: ... purging GI Audit logs under '/u01/app/grid/admin/_mgmtdb/adump' older then 15 days
INFO: 2023-08-21 12:55:56: Cleaning up Listener logs
INFO: 2023-08-21 12:55:56: ... purging Listener logs, ORACLE_BASE is '/u01/app/grid'
INFO: 2023-08-21 12:55:56: ... purging SCAN1 Listener logs, ORACLE_BASE is '/u01/app/grid'
INFO: 2023-08-21 12:55:57: ... purging SCAN2 Listener logs, ORACLE_BASE is '/u01/app/grid'
WARNING: 2023-08-21 12:55:57: Path /u01/app/grid/diag/tnslsnr/db1/listener_scan2/trace does not exist, SCAN2 Listener logs cleanup skipped...
INFO: 2023-08-21 12:55:57: ... purging SCAN3 Listener logs, ORACLE_BASE is '/u01/app/grid'
WARNING: 2023-08-21 12:55:57: Path /u01/app/grid/diag/tnslsnr/db1/listener_scan3/trace does not exist, SCAN3 Listener logs cleanup skipped...
INFO: 2023-08-21 12:55:57: ... purging Management Listener logs, ORACLE_BASE is '/u01/app/grid'
INFO: 2023-08-21 12:55:57: ... purging ASM Listener logs, ORACLE_BASE is '/u01/app/grid'
~~~~~~~~~~~~~~~~~~~~~~adrci GI purge started~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:55:57: Checking if this is an Oracle Restart environment
INFO: 2023-08-21 12:55:57: adrci GI purging diagnostic destination diag/rdbms/_mgmtdb/-MGMTDB
INFO: 2023-08-21 12:55:57: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:55:59: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:56:02: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:56:43: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:56:43: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:56:43: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:56:44: ... purging HM older than 15 days
INFO: 2023-08-21 12:56:44: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:56:44: adrci GI purging diagnostic destination diag/asm/+asm/+ASM1
INFO: 2023-08-21 12:56:44: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:56:44: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:56:45: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:56:59: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:56:59: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:56:59: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:56:59: ... purging HM older than 15 days
INFO: 2023-08-21 12:56:59: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:56:59: adrci GI purging diagnostic destination diag/crs/db1/crs
INFO: 2023-08-21 12:56:59: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:56:59: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:01: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:01: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:02: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:02: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:02: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:02: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:02: adrci GI purging diagnostic destination diag/clients/user_grid/host_3135802894_110
INFO: 2023-08-21 12:57:02: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:02: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:02: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:03: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:03: adrci GI purging diagnostic destination diag/clients/user_root/host_3135802894_110
INFO: 2023-08-21 12:57:03: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:03: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:03: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:03: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:03: adrci GI purging diagnostic destination diag/tnslsnr/db1/asmnet1lsnr_asm
INFO: 2023-08-21 12:57:03: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:03: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:03: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:03: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:03: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:03: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:03: adrci GI purging diagnostic destination diag/tnslsnr/db1/listener_scan1
INFO: 2023-08-21 12:57:03: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:03: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:04: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/tnslsnr/db1/listener
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:04: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/tnslsnr/db1/mgmtlsnr
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:04: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/asmtool/user_grid/host_3135802894_110
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:04: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:04: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:04: ... purging UTSCDMP older than 15 days
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/asmcmd/user_grid/db1
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
WARNING: 2023-08-21 12:57:04: Not able to purge ALERT, due to error: 'DIA-49803: Purge not possible due to incompatible schema version'
WARNING: 2023-08-21 12:57:04: skipping cleanup for homepath 'diag/asmcmd/user_grid/db1'
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/asmcmd/user_oracle/db1
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
WARNING: 2023-08-21 12:57:04: Not able to purge ALERT, due to error: 'DIA-49803: Purge not possible due to incompatible schema version'
WARNING: 2023-08-21 12:57:04: skipping cleanup for homepath 'diag/asmcmd/user_oracle/db1'
INFO: 2023-08-21 12:57:04: adrci GI purging diagnostic destination diag/kfod/db1/kfod
INFO: 2023-08-21 12:57:04: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:04: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:05: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:05: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:05: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:05: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:05: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:05: ... purging UTSCDMP older than 15 days
~~~~~~~~~~~~~~~~~~~~~~GPNP purge started~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:57:05: Purging GPNP client logs older then 15 days
~~~~~~~~~~~~~~~~~~~~~~ACFS purge started~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:57:05: Purging ACFS logs older then 15 days
~~~~~~~~~~~~~~~~~~~~~~adrci RDBMS purge started~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:57:06: Getting dbhome for 'orcl'
INFO: 2023-08-21 12:57:11: adrci RDBMS purging diagnostic destination diag/rdbms/orcl/orcl1
INFO: 2023-08-21 12:57:11: ... purging ALERT older than 15 days
INFO: 2023-08-21 12:57:11: ... purging INCIDENT older than 15 days
INFO: 2023-08-21 12:57:11: ... purging TRACE older than 15 days
INFO: 2023-08-21 12:57:13: ... purging CDUMP older than 15 days
INFO: 2023-08-21 12:57:13: ... purging HM older than 15 days
INFO: 2023-08-21 12:57:13: ... purging STAGE older than 15 days
INFO: 2023-08-21 12:57:13: ... purging SWEEP older than 15 days
INFO: 2023-08-21 12:57:13: ... purging UTSCDMP older than 15 days
~~~~~~~~~~~~~~~~~~~~OH/RDBMS/log purge started~~~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:57:18: OH RDBMS logs purge started
INFO: 2023-08-21 12:57:19: Purging OH RDBMS logs on '/u01/app/oracle/product/19.0.0/db_1/rdbms/log' older then 15 days
~~~~~~~~~~~~~~~~~~~~RDBMS Audit logs purge started~~~~~~~~~~~~~~~~~~~~~~~~~
INFO: 2023-08-21 12:57:20: RDBMS Audit logs purge started
INFO: 2023-08-21 12:57:21: Purging RDBMS Audit logs on '/u01/app/oracle/product/19.0.0/db_1/rdbms/audit' older then 15 days
INFO: 2023-08-21 12:57:21: Purging RDBMS Audit logs on '/u01/app/oracle/admin/orcl/adump' older then 15 days
SUCCESS: 2023-08-21 12:57:21: Cleanup completed succesfully!
-----------------------------------------------------------------------
Above warning 'DIA-49803' could be solved executing following command:
/opt/purgelogs/out/shell/migrate_schema_238621.sh
-----------------------------------------------------------------------
[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 ~]#
文章来源地址https://uudwc.com/A/dPpGg
文章来源:https://uudwc.com/A/dPpGg