1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Auto Backup Using Script

Discussion in 'Security, Backup and Recovery' started by mzainal, Sep 28, 2009.

  1. mzainal

    mzainal Forum Advisor

    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    130
    Hi,

    I want to make auto backup and set using crontab in Linux. But i dont know how to set in crontab. Anyone can tell me how? Please assist me.

    Thank you.
     
  2. mzainal

    mzainal Forum Advisor

    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    130
    This is my script:
    Code (Text):

    # ########################################
    # !/bin/bash
    # Unix controls
    trap cleanup 1 2 3 15
    cleanup()
    {
    echo "Caught CTRL-C Signal ... exiting script."
    exit 1
    }
    # Oracle Variables
    export ORACLE_SID=mission
    export ORACLE_BASE=/u01/app/oracle/product
    export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1/
    export PATH=$PATH:${ORACLE_HOME}/bin
    # RMAN INCREMENTALLY UPDATED BACKUPS (Window of 24 hours)
    rman target=/ << EOF
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mnt/backup/KURAU_CFILE/dwbacks/atbckp_cntrlfile_testdw0%F';
    run {
    ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK FORMAT '/mnt/backup/KURAU_DATA/databasefiles_%d_%u_%s_%T';
    CROSSCHECK BACKUP;
    RECOVER COPY OF DATABASE with TAG 'mission_incr_update';
    BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY with TAG 'mission_incr_update' DATABASE;
    sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
    BACKUP as compressed backupset ARCHIVELOG ALL format '/mnt/backup/MISSION/archivelogs_%d_%u_%s_%T' DELETE INPUT;
    CROSSCHECK BACKUP;
    DELETE NOPROMPT OBSOLETE;
    DELETE NOPROMPT EXPIRED BACKUP;
    RELEASE CHANNEL RMAN_BACK_CH01;
    }
    EXIT;
    EOF
    #########################################