1

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
Rohit Gupta
2,1248 gold badges20 silver badges25 bronze badges
asked Sep 21, 2020 at 10:45

1 Answer 1

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!

answered Sep 21, 2020 at 14:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.