oracle uses adrci to clean up log files (trace files, incident files, listener log files)

Keywords: Oracle

There are usually many log files in oracle. When encountering an abnormal situation, a large number of logs will be generated, resulting in disk space shortage.

Therefore, the corresponding documents need to be cleaned. Including trace file, incident file, listener log file, etc

oracle in 11g provides a command-line tool of ADRCI to view alert log and trace information in ADR, and can delete corresponding log files in batch.

The location of adrci is in the $ORACLE_HOME/bin directory

1. Delete incident file

  • Call adrci
[root@prod-idm-storage incident]# adrci

ADRCI: Release 11.2.0.2.0 - Production on Tue May 7 15:19:08 2019

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/app/oracle"
  • View directory
adrci> show home
ADR Homes:
diag/rdbms/orcl/orcl
  • View incident
adrci> show incident

ADR Home = /app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
INCIDENT_ID          PROBLEM_KEY                                                 CREATE_TIME
-------------------- ----------------------------------------------------------- ----------------------------------------
243353               ORA 227                                                     2018-08-31 09:22:40.871000 +08:00
262554               ORA 227                                                     2018-08-31 09:34:26.395000 +08:00
339426               ORA 1578                                                    2018-09-22 06:01:46.329000 +08:00
339370               ORA 1578                                                    2018-09-22 10:07:49.852000 +08:00
339402               ORA 1578                                                    2018-09-22 14:08:23.558000 +08:00
339386               ORA 1578                                                    2018-09-22 18:08:47.587000 +08:00
339394               ORA 1578                                                    2018-09-22 22:09:26.524000 +08:00
339410               ORA 1578                                                    2018-09-23 06:01:17.392000 +08:00
339387               ORA 1578                                                    2018-09-23 10:10:58.257000 +08:00
339411               ORA 1578                                                    2018-09-23 14:11:21.786000 +08:00
339412               ORA 1578                                                    2018-09-23 18:11:59.186000 +08:00
339413               ORA 1578                                                    2018-09-23 22:12:19.998000 +08:00
339414               ORA 1578                                                    2018-09-24 22:01:20.661000 +08:00
339434               ORA 1578                                                    2018-09-25 22:01:21.496000 +08:00
339415               ORA 1578                                                    2018-09-26 22:01:09.127000 +08:00
339442               ORA 1578                                                    2018-09-27 22:01:26.124000 +08:00
339450               ORA 1578                                                    2018-09-28 22:01:21.893000 +08:00
339403               ORA 1578                                                    2018-09-29 06:01:25.350000 +08:00
339418               ORA 1578                                                    2018-09-29 10:07:14.940000 +08:00
339388               ORA 1578                                                    2018-09-29 14:07:53.091000 +08:00
339389               ORA 1578                                                    2018-09-29 18:08:10.510000 +08:00
339404               ORA 1578                                                    2018-09-29 22:08:50.151000 +08:00
339419               ORA 1578                                                    2018-09-30 06:01:15.858000 +08:00
339390               ORA 1578                                                    2018-09-30 10:10:21.898000 +08:00
339391               ORA 1578                                                    2018-09-30 14:10:47.874000 +08:00
339371               ORA 1578                                                    2018-09-30 18:11:24.833000 +08:00
339405               ORA 1578                                                    2018-09-30 22:11:47.994000 +08:00
339372               ORA 1578                                                    2018-10-01 22:01:17.620000 +08:00
339435               ORA 1578                                                    2018-10-02 22:01:30.078000 +08:00
339451               ORA 1578                                                    2018-10-03 22:01:23.725000 +08:00
339420               ORA 1578                                                    2018-10-04 22:01:21.404000 +08:00
339416               ORA 1578                                                    2018-10-05 22:01:15.775000 +08:00
339421               ORA 1578                                                    2018-10-06 06:01:29.564000 +08:00
339417               ORA 1578                                                    2018-10-06 10:08:21.342000 +08:00
339422               ORA 1578                                                    2018-10-06 14:08:52.711000 +08:00
345607               ORA 1578                                                    2018-10-06 18:09:17.919000 +08:00
345609               ORA 1578                                                    2018-10-06 22:09:56.154000 +08:00
339436               ORA 1578                                                    2018-10-07 06:01:18.502000 +08:00
339406               ORA 1578                                                    2018-10-07 10:01:23.514000 +08:00
339407               ORA 1578                                                    2018-10-07 14:01:46.542000 +08:00
339354               ORA 1578                                                    2018-10-07 18:02:21.533000 +08:00
339355               ORA 1578                                                    2018-10-07 22:02:45.654000 +08:00
339498               ORA 1578                                                    2018-10-08 22:01:23.626000 +08:00
339466               ORA 1578                                                    2018-10-09 22:01:21.970000 +08:00
339467               ORA 1578                                                    2018-10-10 22:01:11.649000 +08:00
339499               ORA 1578                                                    2018-10-11 22:01:17.955000 +08:00
339443               ORA 1578                                                    2018-10-12 22:01:24.071000 +08:00
339423               ORA 1578                                                    2018-10-13 06:01:17.901000 +08:00
339373               ORA 1578                                                    2018-10-13 10:06:37.319000 +08:00
339374               ORA 1578                                                    2018-10-13 14:07:14.910000 +08:00
First 50 rows fetched (*** more available ***)
  • Delete incident 14400=60min*24*100 100 100 100 days ago
adrci>purge -age 144000 -type incident
  • Sign out
adrci> exit
  • Help
adrci> help purge

  Usage: PURGE [[-i <id1> | <id1> <id2>] |
               [-age <mins> [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]]]:

  Purpose: Purge the diagnostic data in the current ADR home. If no
           option is specified, the default purging policy will be used.

  Options:
    [-i id1 | id1 id2]: Users can input a single incident ID, or a
    range of incidents to purge.

    [-age <mins>]: Users can specify the purging policy either to all
    the diagnostic data or the specified type. The data older than <mins>
    ago will be purged

    [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]: Users can specify what type of
    data to be purged.

  Examples:
    purge
    purge -i 123 456
    purge -age 60 -type incident

2. Delete listener log

 

Posted by fatmart on Sat, 16 Nov 2019 06:51:35 -0800