Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-79-2081655.1
Update Date:2018-05-09
Keywords:

Solution Type  Predictive Self-Healing Sure

Solution  2081655.1 :   purgeLogs: Cleanup traces, logs in one command  


Related Items
  • Oracle Cloud Infrastructure
  •  
  • Oracle Database Exadata Cloud Machine
  •  
  • Oracle Database Appliance Software
  •  
  • Exadata Database Machine V2
  •  
  • Exadata Cloud at Customer X6-2 Hardware
  •  
  • Oracle Database Appliance
  •  
Related Categories
  • PLA-Support>Eng Systems>Exadata/ODA/SSC>Oracle Database Appliance>DB: ODA_EST
  •  




In this Document
Purpose
Scope
Details
 Manual cleanup, what is needed to do?
 purgeLogs - Onebutton automation script
 purgeLogs - Usage
 purgeLogs - GI/RDBMS cleanup
 purgeLogs - OSWatcher & OAK cleanup (on ODA - Oracle Database Appliance)
 purgeLogs - Files from "extra" given folders
 purgeLogs - GI/RDBMS, TFA, OSWatcher & OAK cleanup
 purgeLogs - Cleanup listener logs
 Setting up purgeLogs as crontab job
References


Applies to:

Oracle Database Appliance - Version All Versions and later
Oracle Database Appliance Software
Oracle Database Exadata Cloud Machine
Exadata Database Machine V2
Exadata Cloud at Customer X6-2 Hardware
Information in this document applies to any platform.

Purpose

This document explains how to use "purgeLogs" - a tool used to cleanup traces and logs created by different ODA (Oracle Database Appliance) components such Grid Infrastructure, RDBMS, TFA (Trace File Analyzer Collector), OSWatcher, OAK (Oracle Appliance Kit).

Scope

Basic ODA (Oracle Database Appliance) knowledge is required.

Details

On Exadata and/or ODA (Oracle Database Appliance) several components such Grid Infrastructure, RDBMS, TFA (Trace File Analyzer Collector), OSWatcher, OAK (Oracle Appliance Kit) are running producing several traces and logs.

Since a patch update may fail due to filesystem full or some other unexpected behavior, using purgeLog tool can be helpful to cleanup old files.

Manual cleanup, what is needed to do?

In order to cleanup all different trace/log files, several different manual actions are needed:


- From GI prospective:
    - For every single “diag homes”, manually clean several different folders: Alert,Incident,Trace,Cdump,HM
    - TFA repository cleanup
- From RDBMS prospective:
    - For every single “diag homes”, manually clean several different folders: Alert,Incident,Trace,Cdump,HM
    - TFA repository cleanup

- From OSWatcher prospective, remove manually files into

/opt/oracle/oak/oswbb/archive/
|-- oswiostat
|-- oswmeminfo
|-- oswmpstat
|-- oswnetstat
|-- oswprvtnet
|-- oswps
|-- oswslabinfo
|-- oswtop
`-- oswvmstat

- From OAK prospective, remove manually files into "/opt/oracle/oak/log"

/opt/oracle/oak/log/
|-- fishwrap
|-- test
| |-- client
| |-- dcli
| |-- oak
| |-- odabaseagent
| `-- tools
`-- node
|-- adapters
|-- client
|-- dcli
|-- oak
|-- oakvmclient
|-- odabaseagent
|-- tools
`-- utils

purgeLogs - Onebutton automation script

purgeLogs script provides the ability to cleanup automatically in one single command all trace/log/core/... files above based on file ‘age’ and its able to cleanup files from “extra folders” too. The default retention period is 30 days for all components. purgeLog needs to be executed on both nodes.

purgeLogs - Usage

Usage:
purgeLogs [ -days <days> [ -aud ] [ -lsnr ] ]
            [ -orcl <days> [ -aud ] [ -lsnr ] ] |
            [ -tfa <days> ] |
            [ -osw <days> ] |
            [ -oak <days> ] |
            [ -extra '<folder>':<days> | [, '<folder>':<days>] ]
            [ -dryrun ]

purgeLogs OPTIONS
  -days <days> Purge orcl,tfa,osw,oak 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)
  -oak <days> Purge only OAK 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
  -dryrun It will show the purge commands w/o execute them
  -h Display this help and exit

Example:
  purgeLogs
  purgeLogs -days 20
  purgeLogs -orcl 50
  purgeLogs -orcl 50 -aud -lsnr
  purgeLogs -tfa 50
  purgeLogs -osw 20 -oak 10
  purgeLogs -orcl 20 -osw 20 -oak 10
  purgeLogs -orcl 20 -osw 20 -oak 10 -extra /tmp:10,/var/log:20

- purgeLogs need to be executed by root user, note as the "extra" command line option could have potentially destroing behavior as it will delete all files on related folders, use this option with caution, a wrong path might result in data loss. 

- purgeLogs can be used on crontab

Note:
 purgelogs is NOT supported by Oracle World Wide Technical Support.
 The script has been tested and appears to work as intended.
 You should always run new scripts on a test instance initially.
 

purgeLogs - GI/RDBMS cleanup

Cleanup Alert,Incident,Trace,Cdump,HM for the Grid Infrastructure and RDBMS homes removing all file older then 15 days

# ./purgeLogs -orcl 15
2015-11-24 01:58:06: I adrci GI purge started
2015-11-24 01:58:06: I adrci GI purging diagnostic destination diag/asm/+asm/+ASM1
2015-11-24 01:58:06: I ... purging ALERT older than 15 days
2015-11-24 01:58:06: I ... purging INCIDENT older than 15 days
2015-11-24 01:58:06: I ... purging TRACE older than 15 days
2015-11-24 02:04:10: I ... purging CDUMP older than 15 days
2015-11-24 02:04:10: I ... purging HM older than 15 days
2015-11-24 02:04:10: I adrci GI purging diagnostic destination diag/crs/oda101/crs
2015-11-24 02:04:10: I ... purging ALERT older than 15 days
2015-11-24 02:04:10: I ... purging INCIDENT older than 15 days
2015-11-24 02:04:10: I ... purging TRACE older than 15 days
2015-11-24 02:04:23: I ... purging CDUMP older than 15 days
2015-11-24 02:04:23: I ... purging HM older than 15 days
2015-11-24 02:04:23: I adrci GI purging diagnostic destination diag/tnslsnr/oda101/listener_scan2
2015-11-24 02:04:23: I ... purging ALERT older than 15 days
2015-11-24 02:04:24: I ... purging INCIDENT older than 15 days
2015-11-24 02:04:24: I ... purging TRACE older than 15 days
2015-11-24 02:04:24: I ... purging CDUMP older than 15 days
2015-11-24 02:04:24: I ... purging HM older than 15 days
2015-11-24 02:04:24: I adrci GI purging diagnostic destination diag/tnslsnr/oda101/listener
2015-11-24 02:04:24: I ... purging ALERT older than 15 days
2015-11-24 02:04:24: I ... purging INCIDENT older than 15 days
2015-11-24 02:04:25: I ... purging TRACE older than 15 days
2015-11-24 02:04:25: I ... purging CDUMP older than 15 days
2015-11-24 02:04:25: I ... purging HM older than 15 days
2015-11-24 02:04:25: I adrci GI purging diagnostic destination diag/tnslsnr/oda101/asmnet1lsnr_asm
2015-11-24 02:04:25: I ... purging ALERT older than 15 days
2015-11-24 02:04:25: I ... purging INCIDENT older than 15 days
2015-11-24 02:04:26: I ... purging TRACE older than 15 days
2015-11-24 02:04:26: I ... purging CDUMP older than 15 days
2015-11-24 02:04:27: I ... purging HM older than 15 days
(...)
2015-11-24 02:13:56: I adrci RDBMS purging diagnostic destination diag/rdbms/s2test/S2TEST
2015-11-24 02:13:56: I ... purging ALERT older than 15 days
2015-11-24 02:13:56: I ... purging INCIDENT older than 15 days
2015-11-24 02:13:57: I ... purging TRACE older than 15 days
2015-11-24 02:13:57: I ... purging CDUMP older than 15 days
2015-11-24 02:13:57: I ... purging HM older than 15 days
2015-11-24 02:13:57: I Purging completed succesfully!

 

You can include the Grid Infrastructure & RDBMS Audit files using "-aud" option, example:

# ./purgeLogs -orcl 15 -aud

purgeLogs - OSWatcher & OAK cleanup (on ODA - Oracle Database Appliance)

Cleanup OSWatcher archive files and OAK logs, removing all file older then 35 days

# ./purgeLogs -osw 35 -oak 35
2015-11-24 02:05:10: I Purging OSW archives older then 35 days
2015-11-24 02:05:10: I Purging completed successfully!

purgeLogs - Files from "extra" given folders

Cleanup files/traces/cores/... from some given "extra" folders such '/tmp', '/var/log', '/opt/app' with different retention period

# ./purgeLogs -extra '/tmp':10,'/var/log':20,'/opt/app':30
2015-11-24 02:06:13: I Purging files older then 10 days on user specified folder '/tmp'
2015-11-24 02:06:13: I Purging files older then 20 days on user specified folder '/var/log'
2015-11-24 02:06:13: I Purging files older then 30 days on user specified folder '/opt/app'
2015-11-24 02:06:13: I Purging completed succesfully!
Use this option with caution, a wrong path might result in data loss.

purgeLogs - GI/RDBMS, TFA, OSWatcher & OAK cleanup

Cleanup Alert,Incident,Trace,Cdump,HM for the Grid Infastructure and RDBMS homes + TFA archives + OSWatcher archive files + OAK logs, removing all file older then 30 days (default)

# ./purgeLogs
2015-11-24 03:35:35: I adrci GI purge started
(...)
2015-11-24 03:35:40: I adrci RDBMS purge started
(...)
2015-11-24 03:35:44: I Purging TFA archives older then 30 days
2015-11-24 03:35:48: I Purging OSW archives older then 30 days
2015-11-24 03:35:48: I Purging OAK logs older then 30 days
2015-11-24 03:35:49: I Purging completed succesfully! 

purgeLogs - Cleanup listener logs

As described by "Adrci Purge Does Not Clear the Text-formatted Alert.Log located in the Trace Folder (Doc ID 751082.1)", adrci is not cleaning up listener logs. In order to force the cleanup of the following files:

/u01/app/grid/diag/tnslsnr/<hostname>/asmnet1lsnr_asm/trace/mgmtlsnr.log
/u01/app/grid/diag/tnslsnr/<hostname>/mgmtlsnr/trace/asmnet1lsnr_asm.log
/u01/app/grid/diag/tnslsnr/<hostname>/listener/trace/listener.log
/u01/app/grid/diag/tnslsnr/<hostname>/listener_scan1/trace/listener_scan1.log
/u01/app/grid/diag/tnslsnr/<hostname>/listener_scan2/trace/listener_scan2.log

you should use the '-lsnr' option, example:

purgeLogs -orcl 50 -lsnr
Note: with '-lsnr' option, purgeODALog will force the cleanup of listeners log independently by the age

Setting up purgeLogs as crontab job

As example, we are setting up purgeODALog to be executed every day at 2.00am purging GI/Rdbms traces older then 20 days and keeping TFA, OSWatcher and OAK logs not older then 10 days

00 02 * * * /opt/utils/purgeLogs -orcl 20 -tfa 10 -osw 10 -oak 10 

 

Note: As many ODA patches could be staged and applied, the correct method to clean up the repository "/opt/oracle/oak/pkgrepos", outside the purdeLogs scope, is described by the <Note:1681062.1>

 

disk space, cleanup, trace, full, purgeODAlog, filesystem full, oda, exadata

References

<NOTE:1681062.1> - How to clean up the old staged patches on ODA
<BUG:21935420> - LNX64-112-CMT: PLEASE IMPLEMENT A CLEANUP COMMAND

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback