Our company currently runs the databases on RAC (Oracle 11gR2). We generally take the backup of SCHEMAS everyday using the datapump. My issues here is I am unable to delete the dump files older that 3 days using the below script
What is the full path of the files you wish to delete? Your find command did probably not find any files. Do you want to use find with shell globbing, which expands filenames at the command line and does not search sub-directories? You also do not need to use the exec action and can use -iname to disable case sensitiveness.
The find utility is located in /bin under Oracle Linux 6 and /usr/bin under Oracle Linux 5. There is apparently nothing wrong here and cron should be able to execute it with or without specifying the path.
It seems -mtime +3 does not find your files. Please show the following output:
Thank you very much for your quick response. Actually I had to delete a lot of files manually due to storage issue( I am left with only the dump files from of 17,18,19). But my results are weird. I am not able to find the issue. Can you help me
ls -l /nbds2/orabkp/FULL_EXP_FSDEV_*
-rw-r----- 1 oracle oinstall 7013910756 Feb 17 18:21 /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_17_2013.dmp.gz
-rw-r--r-- 1 oracle asmadmin 75805 Feb 17 18:21 /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_17_2013.log
-rw-r--r-- 1 oracle asmadmin 75805 Feb 18 18:21 /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_18_2013.log
-rw-r----- 1 oracle oinstall 7014081297 Feb 19 18:20 /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_19_2013.dmp.gz
-rw-r--r-- 1 oracle asmadmin 75805 Feb 19 18:20 /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_19_2013.log
Ans: Wed Feb 20 09:27:02 PST 2013
Now I am able to delete the files thank you very much for your help.This is the first time I am having this issue I am not sure the reason behind it "date" and "mtime" are conflicting and that is causing the issue. Can you please enlighten me regarding this
For -mtime +1 to work, a file will have to be modified 2 days ago. If this is not what you want, use -mtime 1, without the + sign. Your files have apparently a -8 hour timezone offset. Your current time shows 9 AM. Could your result be due to fractional rounding? What happens if you type the following:
TZ='UTC' ls -l /nbds2/orabkp/FULL_EXP_FSDEV_*
... and compare the find output with various -mtime parameters (with and without the + sign)