1 2 Previous Next 17 Replies Latest reply: Feb 19, 2013 12:11 PM by Dude! RSS

    Unable to delete dump files

    991805
      Hi

      Our company currently runs the databases on RAC (Oracle 11gR2). We generally take the full backup of databases everyday using the datapump. My issues here is I am unable to delete the dump files older that 3 days using the below script

      00 14 * * * find /nbds2/orabkp/*.dmp.gz -mtime +3 -exec rm -f {} \;

      but I am able to delete the files using the below command

      rm -f abcb.dmp.gz . I verified the file permissions etc on the dump file that is generated everything looks fine. Can someone help me


      Thank you

      Karren
        • 1. Re: Unable to delete dump files
          asahide
          Hi,

          What error occured? Permission denied??

          Regards,
          • 2. Re: Unable to delete dump files
            991805
            Its not deleting the files older than 3 days I am not receiving any errors

            Thank you

            Karren
            • 3. Re: Unable to delete dump files
              991805
              but the script is getting executed without any issues but its not able to remove the older files

              Thank you
              Karren
              • 4. Re: Unable to delete dump files
                asahide
                Hi,
                find /nbds2/orabkp/*.dmp.gz -mtime +3 -exec rm -f {} \;
                Could you check follow command?
                find /nbds2/orabkp/*.dmp.gz -mtime +3 -print
                find /nbds2/orabkp/*.dmp.gz -mtime +3 -exec ls -la {} \;

                Regards,
                • 5. Re: Unable to delete dump files
                  onedbguru
                  Also, this is not an Oracle-related problem, it is a user problem as the user does not understand scripting or how to use google or man pages.

                  Next, a datapump export is NOT a backup that could ever be used to actually restore a working database for a PITR. Unless you are doing RMAN, your ability to actually have a usable database after a crash is severely limited. I would nver use this as a "backup" solution.

                  That being said try:

                  00 14 * * * find /nbds2/orabkp/*.dmp.gz -mtime +3 | xargs rm -f

                  $ find $PWD -name "x*x" -mtime +30
                  /home/myuser/xxx
                  /home/myuser/x.x
                  $ find $PWD -name "x*x" -mtime +30 |xargs rm -f
                  $ find $PWD -name "x*x" -mtime +30
                  $ [no files found]
                  • 6. Re: Unable to delete dump files
                    991805
                    I am unable to get any result from those commands nor its giving me any error

                    Karren
                    • 7. Re: Unable to delete dump files
                      asahide
                      Ok,
                      $ ls -la /nbds2/orabkp/*.dmp.gz
                      And put your result here.

                      Regards,
                      • 8. Re: Unable to delete dump files
                        991805
                        Below are my results



                        -rwxrwxr-x----- 1 oracle oinstall 5062432974 Feb 14 19:53 /nbds2/orabkp/FULL_EXP_FDEV_Feb_14_2013.dmp.gz
                        -rwxrwxr-x----- 1 oracle oinstall 5663876975 Feb 15 19:48 /nbds2/orabkp/FULL_EXP_FDEV_Feb_15_2013.dmp.gz
                        -rwxrwxr-x----- 1 oracle oinstall 4896697497 Feb 16 19:59 /nbds2/orabkp/FULL_EXP_FDEV_Feb_16_2013.dmp.gz
                        -rwxrwxr-x----- 1 oracle oinstall 4717006202 Feb 17 19:50 /nbds2/orabkp/FULL_EXP_FDEV_Feb_17_2013.dmp.gz

                        Edited by: 988802 on Feb 18, 2013 4:06 PM
                        • 9. Re: Unable to delete dump files
                          991805
                          Tried to run the script

                          00 14 * * * find /nbds2/orabkp/*.dmp.gz -mtime +3 | xargs rm -f

                          but still the same issue and my files haven't been deleted



                          -rwxrwxr-x----- 1 oracle oinstall 5062432974 Feb 14 19:53 /nbds2/orabkp/FULL_EXP_FDEV_Feb_14_2013.dmp.gz
                          -rwxrwxr-x----- 1 oracle oinstall 5663876975 Feb 15 19:48 /nbds2/orabkp/FULL_EXP_FDEV_Feb_15_2013.dmp.gz
                          -rwxrwxr-x----- 1 oracle oinstall 4896697497 Feb 16 19:59 /nbds2/orabkp/FULL_EXP_FDEV_Feb_16_2013.dmp.gz
                          -rwxrwxr-x----- 1 oracle oinstall 4717006202 Feb 17 19:50 /nbds2/orabkp/FULL_EXP_FDEV_Feb_17_2013.dmp.gz
                          • 10. Re: Unable to delete dump files
                            991805
                            Let me know if you need any more information
                            • 11. Re: Unable to delete dump files
                              991805
                              Can someone please help me with this issue

                              Thank you

                              Karren
                              • 12. Re: Unable to delete dump files
                                asahide
                                Hi,
                                $ find /nbds2/orabkp/*.dmp.gz
                                Regards,
                                • 13. Re: Unable to delete dump files
                                  onedbguru
                                  Try using different "find" syntax:

                                  find /nbds2/orabkp -mtime +3 -name "*.dmp.gz" | xargs rm -f

                                  Create the following script and change your crontab. I would use the script instead of just the command so I can monitor that I know exactly what is being deleted and when it was deleted.

                                  #################cut here - rmdumpfiles #############
                                  #!/bin/bash

                                  echo "starting at `date`"
                                  for i in `find /nbds2/orabkp -mtime +3 -name "*.dmp.gz" `
                                  do
                                  echo "deleting $i "
                                  rm -f $i
                                  done
                                  echo "done at `date` "

                                  #################################################
                                  chmod 750 rmdumpfiles

                                  Crontab entry:
                                  ? ? * * * /home/oracle/rmdumpfiles >> /home/oracle/rmdump.log

                                  [replace ? with your minute/hour]
                                  • 14. Re: Unable to delete dump files
                                    991805
                                    I am sorry to say this but the files haven't been deleted and below is the results I got from the log file

                                    "starting at Mon Feb 18 17:59:01 PST 2013
                                    done at Mon Feb 18 17:59:01 PST 2013"
                                    1 2 Previous Next