I recently ran into a problem where my test systems were running out of space.  Since I like to have a lot of test systems for training purposes, blogging and papers I try to keep them as small as possible.  For my upcoming presentation at IOUG Collaborate 14 I needed a couple of Oracle database 12c RAC clusters for testing Data Guard.

A few days after doing some tests I found that the OEM Cloud Control 12c agent wasn’t responding.  Upon investigation I found that the ADR (Automatic Workload Repository) was full of incidents and traces that were created by some of my tests.  The incidents themselves weren’t a problem, since these were test systems, however, the space that they were taking up was a problem.

So, the question is, how do you remove incidents that are filling up your filesystem?  Again, since these are tests systems I don’t leave very much extra space on them.

The answer is actually very simple.  Use the adrci purge command.  So, to purge all incidents older than 60 minutes run the following:

ADRCI> purge -age 60 -type incident

If you want to purge everything leave off the -type incident as follows:

ADRCI> purge -age 60

Options for type are alert, incident, trace, cdump, hm and utscdmp.

When you first try this you might get the following error:

adrci> purge -age 60 -type incident
DIA-48448: This command does not support multiple ADR homes

In that case, set the home for the incidents that you want to purge by doing the following:

  1. List the homes
  2. Set the home
  3. Purge the incidents

[oracle@rac02a ~]$ adrci

ADRCI: Release – Production on Sun Feb 23 12:18:23 2014

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

ADR base = “/u01/app/oracle”
adrci> show homes
ADR Homes:
adrci> set home diag/rdbms/rac02ct/rac02ct1
adrci> purge -age 60 -type incident

So, let’s take this one step further.  How can I add this to a crontab job to purge my incidents on a daily basis.  Remember, this is a test system.  So, I can put into my Oracle crontab file the following to take care of this once an hour:

# Minute Hour DayofMonth Month DayofWeek Command
00 * * * * /u01/app/oracle/product/ EXEC=”SET BASE /u01/app/oracle; SET HOME diag/rdbms/rac02ct/rac02ct1; purge -age 60″

Obviously you can run this for multiple Oracle homes.  If you are going to do that I would recommend putting them all into a shell script and just running the script from crontab.

This is an easy way to keep your test systems from running out of space from ADR entries.  This probably isn’t such a good idea for a production system.