Friday, July 27, 2012

Backup Oracle on SLES using VMware Snapshot

/usr/sbin/pre-freeze-script
#!/bin/bash
/bin/su - oracle -c "echo $(date) >> /u01/app/oracle/snapshot.log"
/bin/su - oracle -c "/u01/app/oracle/product/11.2.0/xe/bin/sqlplus /nolog @/u01/app/oracle/suspend.sql >> /u01/app/oracle/snapshot.log"

/usr/sbin/post-thaw-script

#!/bin/bash
/bin/su - oracle -c "echo $(date) >> /u01/app/oracle/snapshot.log"/bin/su - oracle -c "/u01/app/oracle/product/11.2.0/xe/bin/sqlplus /nolog @/u01/app/oracle/resume.sql >> /u01/app/oracle/snapshot.log"

/u01/app/oracle/suspend.sql
connect / as sysdba;
ALTER SYSTEM SUSPEND;
exit;

/u01/app/oracle/resume.sql
connect / as sysdba;
ALTER SYSTEM RESUME;
exit;
/u01/app/oracle/.bash_profile
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export PATH=$ORACLE_HOME/bin:$PATH



2 comments:

  1. Hi Calvin,

    What are your experiences regarding this? Furthermore - what is your whole strategy behind that? What I'm asking myself - you take a snapshot of your machine let's say at 8 in the morning. meanwhile you backup the archived redo logs aof the oracle with the Symantec Netbackup Agent elsewhere. Lets say at 11:00 clock the maschine crashes and you restore the whole VM with the snapshot you took a 8:00. Is it possible the easily recover the database with the backed up redo logs by netbackup means?

    Thank you in advance & regards from Cologne/Germany

    Joerg Bartke

    ReplyDelete
    Replies
    1. Thank you for your question.

      I think it would be the same in old days.

      In old days, your system crashes on OS level.

      You restore last FULL backup from tape, and do recovery log management.
      Old days tape backup has Oracle agent to suspend oracle DB to ensure all cache data/redo log is write to disk on both OS level and DB level

      Nowadays, we have our OS on VM.
      We have software like Veeam to backup VM using snapshot without and Oracle Agent.

      So to ensure all disk cache is written to VMDK.
      the above script should be set while taking snapshot.

      Restoring above snapshot will be the same as you recovery it from tape as old days.
      And doing redo log recovery would be the same as old days also.

      Delete