#!/bin/sh

# <http://www.praetoriate.com/op_unix_171_core_dump_files.htm>

# Part of the job of the Oracle DBA on a UNIX server is to e-mail
# current trace and core dump files to Oracle support and e-mail
# application trace and dump files to code developers. Once problems have
# been resolved, the DBA must remove unwanted files from the Oracle UNIX
# filesystem. These un-wanted files may include:

#  * Trace files - Trace files become obsolete as soon as they have been mailed to the developer staff.
#  * Core files - Core files may be removed as soon as Oracle support has received copies of the dump.
#  * Audit files - Audit files are a nuisance that many DBAs remove every day.

# Cleanup trace files more than 7 days old

DBA=/opt/oracle/admin/
ORACLE_SID=vicious

find $DBA/$ORACLE_SID -name '*.trc' -type f -mtime +7 -exec rm {} \;
find $DBA/$ORACLE_SID/cdump -name 'core' -type f -mtime +7 -exec rm {} \;
rmdir $DBA/$ORACLE_SID/cdump/core_* 2>/dev/null




