Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    102

    Unanswered: autodata backup using crontab in linux RH9

    Hi all

    I'm using oracle 9i and on linux HR9. Now i want to auto databackup using crontab utility in linux.

    in the crontab i write the following :

    59 16 * * * /database/app/oracle/product/9.2.0.1.0/bin/exp SYSTEM/SYSADMIN FULL=Y file=/data-backup/SYSTEM.DMP

    But it is not working. My oracle home path is correct.

    Please advice me..........

    Thanks in advace you all.
    Working Together...

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    1) I do NOT consider using export to provide adequate "backup" for any DB.
    2) cron jobs do not by default run any "dot files" (.bash_profile, etc) so their environment is sorely lacking. Oracle related cron invoked scripts need to manually source in the appropriate "environmental" file(s).
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Nov 2004
    Location
    Temple University
    Posts
    36

    Cool

    Crontab entry:
    05 18 * * * /usr/local/scripts/oracle/exports/export.sh tuhs84 1>>/usr/local/scripts/oracle/exports/export.log 2>&1
    SID (database )NAME = tuhs84

    EXPORT.SH
    export ORACLE_SID=$1
    export ORACLE_HOME=/app/oracle/product/9.2
    DT=`date +%m%d%y` ; export DT
    EXP_DIR="/export/$ORACLE_SID"; export EXP_DIR
    export BKTYPE=EXP
    export NAME=$ORACLE_SID$BKTYPE$DT
    export CNAME=$BKTYPE$DT
    LOGFILE="/export/$ORACLE_SID/$CNAME.log"; export LOGFILE
    export EXPLOG="/export/$ORACLE_SID/$NAME.log"
    export EXPFILE="/export/$ORACLE_SID/$NAME.dmp"
    export ORAPAR="/usr/local/scripts/oracle/exports"
    find $EXP_DIR/*.Z -mtime +3 -exec rm {} \;
    find $EXP_DIR/*.log -mtime +3 -exec rm {} \;
    $ORACLE_HOME/bin/exp dbbackup/dbbackup file=$EXPFILE log=$EXPLOG parfile=$ORAPAR/exp.par >> $LOGFILE 2>&1 ;
    echo "Export of $ORACLE_SID successful" >> $LOGFILE;
    compress /export/$ORACLE_SID/*.dmp;
    echo "Compress finished at:" >> $LOGFILE;
    date >> $LOGFILE;
    exit 0;


    Please notice that all ENVIRONMENT variables are set from within export.sh. Also note that the SID name is passed to export.sh as a VARIABLE. All the required file names (including the name of parfile) are exported as environment variables. Lastly, the export.sh runs a compress against all the created files. This way, the export and log files will be identified by having the date as an integral part of the file name.

    IB2KOOL

  4. #4
    Join Date
    Nov 2004
    Location
    Temple University
    Posts
    36
    Almost forgot.
    I only do this as a LAST RESORT. Every week the database goes down for a cold backup, and every night RMAN performs a hot backup. The export is just a little extra insurance, and should NOT be relied upon as you main source of disaster recovery.

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •