question about a hot backup script
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: question about a hot backup script

  1. #1
    Join Date
    Apr 2004
    Posts
    1

    question about a hot backup script

    hi
    when i test a hot backup script, it stopped after exit from sqlplus at the first time. but it should enter sqlplus 3 times. what's the reason of this? help plz.
    the script is here:
    #!/bin/bash
    #
    # Set up environment variables:
    ORACLE_SID=odb; export ORACLE_SID
    ORACLE_BASE=/ora01/app/oracle; export ORACLE_BASE
    ORAENV_ASK=NO; export ORAENV_ASK
    . oraenv
    DT=`date +%Y.%m.%d`

    sqlplus internal <
    alter tablespace SYSTEM begin backup;
    !tar -cvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/system01.dbf
    alter tablespace SYSTEM end backup;

    alter tablespace RBS begin backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/rbs01.dbf
    alter tablespace RBS end backup;

    alter tablespace DATA begin backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar /home/datafile/*
    alter tablespace DATA end backup;

    alter tablespace INDX begin backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/indx01.dbf
    alter tablespace INDX end backup;

    alter tablespace TEMP begin backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/temp01.dbf
    alter tablespace TEMP end backup;

    alter tablespace TOOLS begin backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/tools.dbf
    alter tablespace TOOLS end backup;

    alter tablespace DRSYS start backup;
    !tar -rvf /export/Hot_Backup/Backup-$DT.tar $ORACLE_BASE/oradata/oradb/drsys01.dbf
    alter tablespace DRSYS end backup;

    archive log stop

    exit
    EOFarch1

    FILES=`ls $ORACLE_BASE/admin/oradb/arch/arch*.dbf`; export FILES

    sqlplus internal < archive log start;
    exit
    EOFarch2

    tar -rvf /export/Hot_Backup/Backup-$DT.tar $FILES
    rm -f $FILES

    sqlplus internal < alter database backup controlfile to
    '/export/Hot_Backup/ControlFile/odb/controlfile.bck';
    exit
    EOFarch3

    tar -rvf /export/Hot_Backup/Backup-$DT.tar /export/Hot_Backup/ControlFile/oradb/controlfile.bck

  2. #2
    Join Date
    Sep 2003
    Location
    over the hill and through the woods
    Posts
    995
    I feel your pain on this but may I suggest a better approach?
    http://www.dbasupport.com/oracle/scr...iled/179.shtml
    I think you will find that this script is better than the one you have. Yes, it's a little more complicated but it's designed for simplicity. Meaning that if you add a new datafile you won't have to edit your script he'll find it. I've used this script before and it's a good one.

    good luck!
    Oracle it's not just a database it's a lifestyle!
    --------------
    BTW....You need to get a girlfriend who's last name isn't .jpg

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