Managing Oracle ADR in a test/dev environment

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 12.1.0.1.0 – 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:
diag/apx/+apx/+APX1
diag/tnslsnr/rac02a/listener_scan1
diag/tnslsnr/rac02a/mgmtlsnr
diag/tnslsnr/rac02a/listener_scan3
diag/tnslsnr/rac02a/listener_scan2
diag/tnslsnr/rac02a/asmnet1lsnr_asm
diag/tnslsnr/rac02a/listener
diag/asm/+asm/+ASM1
diag/clients/user_root/host_1690042094_80
diag/clients/user_oracle/host_1690042094_80
diag/rdbms/rac02ct/rac02ct1
diag/rdbms/rac02ct/rac02ct
diag/rdbms/_mgmtdb/-MGMTDB
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/12.1.0.1/dbhome_1/bin/adrci 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.

 

 

By |2017-09-20T08:31:21+00:00February 23rd, 2014|Out Perform, Tips|Comments Off on Managing Oracle ADR in a test/dev environment