correct my script shell to backup with rman
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: correct my script shell to backup with rman

  1. #1
    Join Date
    Mar 2017
    Posts
    2

    correct my script shell to backup with rman

    Hi EVERYBODY,
    hope you are doing well,
    i am not an expert on linux
    i try to create script shell to backup with rman
    i did some configuiration regarding some parameter

    below my script

    Code:
    #!/bin/sh
    export ORACLE_SID=bss
    export ORACLE_HOME=/home/oracle/10.2.0/db/
    cd /home/oracle/10.2.0/db/bin
    ./rman
    exit
    connect target sys/bss
    {
    run
    backup incremental   0 database plus archivelog;
    }
    Last edited by gandolf989; 03-24-2017 at 11:38 AM.

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,147
    Here is my version. This presumes that you have enterprise edition and a block change tracking file.
    If you don't have both then you won't be doing true incremental backups. If you do then you need
    to do an "incremental 0" once per week and an "incremental 1" the other 6 days.

    But this should get you started. It will also clean up old backups and archive logs. You will need
    to change the retention depending on what works for you. You also need to put in a value for
    backup directory.

    Code:
    #!/bin/bash
    
    export ORACLE_SID=bss
    export ORACLE_HOME=/home/oracle/10.2.0/db/
    export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
    export TNS_ADMIN=${ORACLE_HOME}/network/admin
    export PATH:${ORACLE_HOME}/bin:${PATH}
    
    export BACKUPDIR="backup directory"
    
    export CURR_TIME=`/bin/date +%Y%m%d_%H%M%S`
    export RMANLOGFILE=${BACKUPDIR}/backup_rman_${ORACLE_SID}_${CURR_TIME}.log
    
    exec >${RMANLOGFILE}
    exec 2>&1
    
    rman connect target / >>EOF
    # configuration commands
    CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
    CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO COMPRESSED BACKUPSET;
    CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
    
    configure channel device type disk format '${BACKUPDIR}/%d_%Y_%M_%D_%t_%s_%c_%p';
    
    run {
    BACKUP CURRENT CONTROLFILE;
    SQL "alter system switch logfile";
    backup incremental 0 database plus archivelog;
    }
    
    CHANGE ARCHIVELOG ALL CROSSCHECK;
    CROSSCHECK BACKUP;
    DELETE NOPROMPT OBSOLETE;
    EOF
    exec 1>&-
    exec 2>&-
    this space intentionally left blank

  3. #3
    Join Date
    Mar 2017
    Posts
    2
    HI GANDOLF989,
    i will active block change track on my database .
    let me test it and i come back to you
    but thank advance for your help.

    best regard
    Leopold Godo

Posting Permissions

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


Click Here to Expand Forum to Full Width