Forgot your password?    
+ Reply to Thread
Results 1 to 1 of 1

Thread: RMAN Script to take a Hot Backup of Database using Catalog

  1. #1
    Expert Oracle Administrator
    Join Date
    Oct 2011
    Location
    New Delhi, India
    Posts
    427

    RMAN Script to take a Hot Backup of Database using Catalog

    # This script can be used to take a hot backup using RMAN.
    # Some of the variables in the initial section of the script need to have valid values
    # Set the catalog to the catalog database
    # This script will also mail errors encountered in the backup process


    # =============================

    #!/bin/sh

    export ORACLE_SID=PROD
    export ORACLE_HOME=....
    export PATH=$ORACLE_HOME/bin:$PATH
    export TNS_ADMIN=$ORACLE_HOME/network/admin


    DBA="hemant@dbalounge.com"
    INST=`hostname`
    TODAY=`date +%d%b`
    BACKUP_DIR=/u01/backup/
    LOG_DIR=/u01/backup/logs
    LOGFILE=$LOG_DIR/rman_backup_${ORACLE_SID}_${TODAY}.log
    ERRFILE=$LOG_DIR/err_status.log
    $ORACLE_HOME/bin/rman <<EOF > ${LOG_DIR}/rman_backup_${ORACLE_SID}_${TODAY}.log
    connect target/
    connect catalog rman/rman@rmandb
    run {
    allocate channel t1 TYPE DISK;
    setlimit channel t1 kbytes 2048000;
    allocate channel t2 TYPE DISK;
    setlimit channel t2 kbytes 2048000;
    allocate channel t3 TYPE DISK;
    setlimit channel t3 kbytes 2048000;
    allocate channel t4 TYPE DISK;
    setlimit channel t4 kbytes 2048000;
    backup full tag BACKUP_FULL_${ORACLE_SID} format '${BACKUP_DIR}/%d_%t_%p_%s_%c_%u.dbf' database;
    backup current controlfile format '${BACKUP_DIR}/%d_%t_%p_%s_%c_%u.ctl';
    sql 'alter system archive log current';
    backup archivelog all format '${BACKUP_DIR}/%d_%t_%p_%s_%c_%u.arc'
    archivelog until time 'sysdate-3' delete input;
    release channel t1;
    release channel t2;
    release channel t3;
    release channel t4;
    }
    EOF

    egrep "RMAN-|ORA-" $LOGFILE > $ERRFILE
    if [ -s $ERRFILE ]; then
    mail -s "PROD RMAN Backup FAILED $ORACLE_SID" $DBA < ${LOG_DIR}/rman_backup_${ORACLE_SID}_${TODAY}.log
    else
    mail -s "PROD RMAN Backup SUCCESS $ORACLE_SID" $DBA < ${LOG_DIR}/rman_backup_${ORACLE_SID}_${TODAY}.log
    fi

+ Reply to Thread

Similar Threads

  1. Dynamic Script to take Hot Backup of Oracle Database
    By Hemant in forum Backup, Restoration & Recovery, RMAN, Flashback, Datapump, Export, Import
    Replies: 10
    Last Post: 03-14-2012, 11:40 PM
  2. RMAN Catalog Creation.
    By ajaychandi in forum Backup, Restoration & Recovery, RMAN, Flashback, Datapump, Export, Import
    Replies: 0
    Last Post: 02-18-2012, 12:19 AM
  3. Replies: 1
    Last Post: 01-01-2012, 03:50 PM
  4. Regarding Rman backup retention policy
    By ajaysingh in forum Backup, Restoration & Recovery, RMAN, Flashback, Datapump, Export, Import
    Replies: 3
    Last Post: 11-09-2011, 07:27 PM
  5. Backup & Restoration of Control Files using RMAN
    By sandeep.negi27 in forum Backup, Restoration & Recovery, RMAN, Flashback, Datapump, Export, Import
    Replies: 1
    Last Post: 11-03-2011, 01:13 PM

Tags for this Thread

Posting Permissions

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

DBA Lounge (P) Ltd. deals in Oracle Technologies on Consulting, Resourcing, Corporate Training


Online and corporate training available on Oracle Database 11g, Oracle 11g Real Application Cluster (RAC), Oracle Applications 11i/R12, Oracle Fusion Middleware 11g, Oracle Identity Management-OIM, Oracle Internet Directory 11g-OID, Oracle Business Intelligence Enterprise Edition-OBIEE, Oracle Golden Gate, Oracle Access Management-OAM, Oracle Internet Directory-ODS, Oracle Identity Analytics Architecture-OIA Statistics