cancel
Showing results for 
Search instead for 
Did you mean: 

CRON

prasanth.ps
Frequent Advisor

CRON

Hi to all...

i want to clarify one doubt.
am exporting the my oracle databse table by using the following command in the linux prompt.

$ exp username/password file=username_DDMMYYYY.dmp owner=username

I waant to run this coammnd daily 8 o clock night and i want to change the date in the file field and want to delete the previous day *.dmp file too.


Is this is possible with cron job.
if yes please explain me how to do?

thanx in advance.


Prasanth
2 REPLIES
Oviwan
Honored Contributor

Re: CRON

Hey

create (or generate through a shell script) a parameter file for the export:

$cat export.par
userid=username/password
file=username_DDMMYYYY.dmp
owner=username

then execute it from cron "exp parfile=/path/to/export.par"

Regards
Ivan Ferreira
Honored Contributor

Re: CRON

You can do it with something like this:


EXPDIR=/export
exp username/password file=$EXPDIR/$USERNAME_$(date +%d%m%Y).dmp owner=$USERNAME

if [ $? -eq 0 ]
then
find $EXPDIR -name $USERNAME*.dmp -mtime +1 -exec rm {}\;
fi

Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?