Version: Oracle Linux 6.4
In the below directory, we had 1.6 million audit log files with the extention .aud which are older than 20 days .
I ran a find with rm command as shown below. But, I had to cancel the execution of the below command after 4 hours as I don't want to run a long running command during peak hours
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;
Question1.Is there a way I could tweak this command to run faster ?
This server has no shortage of CPUs. It has 40 CPU cores ( 80 cores when Hyperthreading is considered ). It has 256G RAM too.
Later I realized that this directory has files which are older than 500 days. So, I should have done this in chunks ; 100 at time as shown below.
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +400 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +300 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +200 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +100 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;
So, I ran the following command to delete files older than 500 days. But it still took 32 minutes to delete 76,000 files !!
$ find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 | wc -l
76099
$ find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 -exec rm -f {} \;
So, I would like to know if there is a way I could tweak this command to run faster ?
Question2.
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;
During the above mentioned find and rm command execution , from another session, I tried to run an ls command on this directory to see how many files are remaining. But, I got the below error
$ pwd
/u01/product/11.2.0/rdbms/audit
$ ls -alrdt *.aud | wc -l
-bash: /bin/ls: Argument list too long
0
Is there a way I could see the progress of this command with something like a progress bar?