Q

Explanation of code for deleting audit files

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:

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


This was first published in June 2001

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close