Brian Peasland's tip "Do you have audit files?" of 24 May 2001 used the following code to delete the audit files that were over 30 days old:
Requires Free Membership to View
find $ORACLE_HOME/rdbms/audit/*.aud -mtime +30 -exec rm -f {} ;
My version of HP-UX can work with this up to and including the rm to remove the files. What is the -f switch, and what does it do? What do the {} and ; indicate, and what do they do? Thanks, Steve
Steve,
I hope that the tip is serving you well. Here I offer up some further
explanation. According to the manual (man rm), the -f switch means:
-f Do not prompt for confirmation. Do not write diag-
nostic messages or modify the exit status in the
case of non-existent operands. Any previous
occurrences of the -i option will be ignored.
The easiest way to think of this is that 'f' stands for "force". It means to ignore the confirmation prompt and force the delete no matter what.
The results of the find command are passed as arguments to the spawned command, via the -exec switch. In this case, the spawned command is the remove (rm) command. We use the braces, '{}' as a place holder for the arguments to the rm command. I'm not sure why the '\;' is there other than it needs to be. It is a requirement of the -exec switch. Again checking the manual (man find), we can find the following:
-exec command
True if the executed command returns a zero value
as exit status. The end of command must be punc-
tuated by an escaped semicolon. A command argu-
ment {} is replaced by the current path name.
The manual talks about the braces as a place holder for the results of the find command. Furthermore, the manual says "The end of command must be punctuated by an escaped semicolon." I'm not a Unix guru, so I don't know exactly why it is required, but the manual says that it is required.
If you are having problems with this on your HP-UX platform, then I do have another solution written in Perl. I know that this command works on Sun Solaris and SG Irix. Unfortunately, I do not have the same functionality on a Windows platform. So I had to write a Perl script which performs the same function. If you need a copy, please ask!
For More Information
- What do you think about this answer? E-mail us at editor@searchDatabase.com with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
- Ask the Experts yourself: Our Oracle gurus are waiting to answer your toughest questions.
This was first published in June 2001

Join the conversationComment
Share
Comments
Results
Contribute to the conversation