0

I want to delete my export files daily from ASM diskgroup with a crontab job. I want to prepare a script for it.

ASMCMD> ls

exp1.dmp

exp2.dmp

exp3.dmp

exp4.dmp

ASMCMD> pwd

+DATA/EXP

How can I prepare this script? I prepared a template for it, but I couldn't script it.

set_gridenv

asmcmd

cd +DATA/EXP

rm -rf exp*.dmp

exit

Best regards,

0

Just did a small test.

# find some ASM files
asmcmd find DATA/T101N/AUTOBACKUP/2020_09_20/ \*
+DATA/T101N/AUTOBACKUP/2020_09_20/s_1051641713.313.1051641713
+DATA/T101N/AUTOBACKUP/2020_09_20/s_1051658719.331.1051658719

# remove them one-by-one
asmcmd rm DATA/T101N/AUTOBACKUP/2020_09_20/s_1051641713.313.1051641713
asmcmd rm DATA/T101N/AUTOBACKUP/2020_09_20/s_1051658719.331.1051658719

# they are gone
asmcmd find DATA/T101N/AUTOBACKUP/2020_09_20/ \*
ASMCMD-8002: entry 'AUTOBACKUP' does not exist in directory '+DATA/T101N/'

Your scenario should be similar:

#!/bin/bash

# set grid home
. oraenv <<< +ASM

# delete dump-files
asmcmd rm -rf DATA/EXP exp\*.dmp

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.