Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: export from crontab
Raghu Kota (WBTQ) wrote:
> Hi Friends,
>
> Iam trying to run an export from crontab on last Thursday of every =
> month, the logic seems working but I got an error saying invalid Time =
> Zone!! with this error "ORACLE error 1857 encountered", without this =
> Thursday checking logic everything works! my environment is oracle8174 =
> on aix51. Any ideas where Iam doing wrong??
>
> TIA
> Raghu.
>
> My export Script:-
> variables here...
>
> #####################Check for last Thursday of the month##########
>
> TODAYMONTH=3D`date +%m`
> # subtract 168 hours (one week from the TZ parameter)
> # in my case TZ=3DEST5EDT
> TZ=3DEST-162EDT
> NEXTWKMONTH=3D`date +%m`
> if [ $TODAYMONTH -ne $NEXTWKMONTH ]
> then
> #it's the last Thursday of the month
> echo "Oracle Export: `date`" >>${LFILE} 2>&1
> else
> echo "Sorry!! Today is not last Thu of the Month!! : `date`" =
>
>>>${LFILE} 2>&1
It doesn't seem very wise to be changing your TZ variable on the fly to such an unorthodox value, especially since this appears to be causing your ORA error.
A quick search of Google yielded the following sample crontab entry, which seems to be exactly what you want (even down to the Thursday choice):
0 1 25-31 * * [ "$(date +\%a)" == "Thu" ] && script_with_no_date_logic
http://unix.derkeiler.com/Mailing-Lists/AIX-L/2005-02/0023.html
-- Mark Bole http://www.bincomputing.com -- http://www.freelists.org/webpage/oracle-lReceived on Thu Feb 24 2005 - 12:50:31 CST