## Shell script to perform HOT Database Backups to Disk #! /bin/ksh HOT=/CML/oracle/HOT/${ORACLE_SID} LOG=/dsk5/${ORACLE_SID}/dump/alert_${ORACLE_SID}.log if [ -f $LOG ] ; then Bgn_Bkp=‘egrep -ci '^alter tablespace .* begin backup' $LOG‘ End_Bkp=‘egrep -ci '^alter tablespace .* end backup' $LOG‘ Diff_Bkp=‘expr $Bgn_Bkp - $End_Bkp‘ else mail oracle < ${HOT}/' || substr(file_name,instr(file_name,'/',-1) + 1) || '.Z' from sys.dba_data_files where status = 'AVAILABLE' UNION select tablespace_name, 9999, 'alter tablespace '||tablespace_name||' end backup;' from sys.dba_tablespaces where status = 'ONLINE' UNION select chr(255) tablespace_name, 9998 seqn, 'alter database backup controlfile to ''' || '${HOT}/controlfile_${ORACLE_SID}.HOT.full.after'' reuse;' from dual UNION select chr(255) tablespace_name, 9999 seqn, 'alter system switch logfile;' from dual ORDER BY 1, 2 spool /tmp/ora_HOT_backup.sql / spool off start /tmp/ora_HOT_backup.sql exit EOF Bgn_Bkp=‘egrep -ci '^alter tablespace .* begin backup' $LOG‘ End_Bkp=‘egrep -ci '^alter tablespace .* end backup' $LOG‘ if [ $Bgn_Bkp != ‘expr $End_Bkp + $Diff_Bkp‘ ] ; then mail oracle <