This discussion is archived
14 Replies Latest reply: Feb 20, 2013 10:29 AM by 991805 RSS

DUMP FILES UNABLE TO DELETE IN LINUX

991805 Newbie
Currently Being Moderated
Hi

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

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.

Even I tried using the below script

#################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:
00 14 * * * /home/oracle/rmdumpfiles >> /home/oracle/rmdump.log

But the files didn't get deleted and below is the information 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"

Can someone help me please

Thank you

Karren
  • 1. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    rukbat Guru Moderator
    Currently Being Moderated
    It would have been polite to paste a link to the ongoing thread you already have in the RAC forum:
    Unable to delete dump files
    where it was eventually suggested to post to this Linux forum.
  • 2. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    I am new to this forum thank you very much for your suggestion. Can you please help me with this issue
  • 3. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    Dude! Guru
    Currently Being Moderated
    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.

    Perhaps the following works better:
    /bin/find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3 -delete
    Btw, uppercase lettes, e.g.: your subject line, are considered shouting. Do you want to shout?
  • 4. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    What is the full path of the files you wish to delete?
    Ans: /nbds2/orabkp

    Your find command did probably not find any files.
    Ans: It is able to find the files

    find /nbds2/orabkp/*.dmp.gz

    -rwxrwxr-x 1 oracle oinstall 7002432974 Feb 16 19:53 FULL_EXP_FSDEV_Feb_16_2013.dmp.gz
    -rwxrwxr--x 1 oracle oinstall 7013910756 Feb 17 18:21FULL_EXP_FSDEV_Feb_17_2013.dmp.gz
    -rwxrwxr-x 1 oracle oinstall 7663876975 Feb 18 19:48 FULL_EXP_FSDEV_Feb_18_2013.dmp.gz

    I tried to use

    /bin/find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3 -delete

    and below is the error message I got

    /bin/find: No such file or directory

    Edited by: 988802 on Feb 20, 2013 9:31 AM
  • 5. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    Dude! Guru
    Currently Being Moderated
    Can you provide the full complete output as you get it, including your shell prompt? Are you using Linux, what distribution? Your current output looks like it does not find the find command.

    What is your output of:

    <pre>
    which find
    cat /etc/*release
    echo $PATH
    echo $SHELL
    </pre>

    Cron, btw, only knows /bin and /usr/bin, so if your find is not there, you need to specify the full path.

    -mtime +3 also means files that were last modified 3 days ago. Do any files meet this criteria?
  • 6. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    I used the below simple script as shown below

    #################Removal of dumpfiles #############
    #!/bin/bash
    /bin/find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3 -delete

    Below is the error message I got

    ./removefiles.sh: line 3: /bin/find: No such file or directory
  • 7. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    cat /etc/*release
    Enterprise Linux Enterprise Linux Server release 5.8 (Carthage)
    Oracle Linux Server release 5.8
    Red Hat Enterprise Linux Server release 5.8 (Tikanga)

    echo $PATH
    /u01/app/oracle/product/11.2.0.3/dbhome_1/bin:.:/usr/NX/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin

    echo $SHELL
    /bin/bash

    Yes the files meet the criteria

    Edited by: 988802 on Feb 19, 2013 1:07 PM

    Edited by: 988802 on Feb 20, 2013 9:46 AM
  • 8. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    Can someone please help me with this issue

    Karren

    Edited by: 988802 on Feb 19, 2013 3:51 PM
  • 9. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    Dude! Guru
    Currently Being Moderated
    What is your output of the following 4 commands:

    <pre>
    id
    which find
    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3
    find /nbds2/orabkp/* -iname "*.dmp.gz" -ls
    </pre>
  • 10. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    id
    Ans: uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba),1003(racoper),1004(asmdba)

    which find
    Ans: /usr/bin/find ( Tried /usr/bin/find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3 -delete command got executed but the files remained the same)

    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3
    Ans: None

    Edited by: 988802 on Feb 20, 2013 9:28 AM
  • 11. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    Dude! Guru
    Currently Being Moderated
    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:

    <pre>
    stat /nbds2/orabkp/FULL_EXP_FSDEV_Feb_15_2013.dmp.gz

    date

    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3
    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +2
    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +1
    </pre>
  • 12. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    Hi Dude,

    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

    stat /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_17_2013.dmp.gz
    File: `/nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_17_2013.dmp.gz'
    Size: 7013910756 Blocks: 13753000 IO Block: 65536 regular file
    Device: 16h/22d Inode: 21604 Links: 1
    Access: (0640/-rw-r-----) Uid: ( 1001/ oracle) Gid: ( 1001/oinstall)
    Access: 2013-02-17 18:00:04.000000000 -0800
    Modify: 2013-02-17 18:21:11.000000000 -0800
    Change: 2013-02-17 18:26:41.988556000 -0800

    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +3

    Ans: None

    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +2

    Ans: None

    find /nbds2/orabkp/* -iname "*.dmp.gz" -mtime +1

    Ans: /nbds2/orabkp/FULL_EXP_FSDEV_expdp_Feb_17_2013.dmp.gz

    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

    date

    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

    Edited by: 988802 on Feb 20, 2013 9:42 AM

    Edited by: 988802 on Feb 20, 2013 10:04 AM
  • 13. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    Dude! Guru
    Currently Being Moderated
    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:

    <pre>
    TZ='UTC' ls -l /nbds2/orabkp/FULL_EXP_FSDEV_*
    </pre>

    ... and compare the find output with various -mtime parameters (with and without the + sign)
  • 14. Re: DUMP FILES UNABLE TO DELETE IN LINUX
    991805 Newbie
    Currently Being Moderated
    Thank you dude now I get it thanks a lot for your help

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points