Wednesday, April 20, 2011

cronjob hotbackupscripts and begin backup and end backups scripts

@daily sh /u01/d01/backupscripts/starthotbackup_12AM.sh #Oracle Database Hotbackup daily
* 22 * * * sh /u01/d01/backupscripts/compressarchive.sh


alter system switch logfile;
alter tablespace SYSTEM begin backup;
alter tablespace CTXD begin backup;
alter tablespace OWAPUB begin backup;
alter tablespace ODM begin backup;
alter tablespace PORTAL begin backup;
alter tablespace APPS_UNDOTS1 begin backup;
alter tablespace APPS_TS_TX_DATA begin backup;
alter tablespace APPS_TS_TX_IDX begin backup;
alter tablespace APPS_TS_SEED begin backup;
alter tablespace APPS_TS_INTERFACE begin backup;
alter tablespace APPS_TS_SUMMARY begin backup;
alter tablespace APPS_TS_NOLOGGING begin backup;
alter tablespace APPS_TS_ARCHIVE begin backup;
alter tablespace APPS_TS_QUEUES begin backup;
alter tablespace APPS_TS_MEDIA begin backup;
alter tablespace OLAP begin backup;

exit
~

[oraprod@jtlprod backupscripts]$ vi endbackup.sql
alter tablespace SYSTEM end backup;
alter tablespace CTXD end backup;
alter tablespace OWAPUB end backup;
alter tablespace ODM end backup;
alter tablespace PORTAL end backup;
alter tablespace APPS_UNDOTS1 end backup;
alter tablespace APPS_TS_TX_DATA end backup;
alter tablespace APPS_TS_TX_IDX end backup;
alter tablespace APPS_TS_SEED end backup;
alter tablespace APPS_TS_INTERFACE end backup;
alter tablespace APPS_TS_SUMMARY end backup;
alter tablespace APPS_TS_NOLOGGING end backup;
alter tablespace APPS_TS_ARCHIVE end backup;
alter tablespace APPS_TS_QUEUES end backup;
alter tablespace APPS_TS_MEDIA end backup;
alter tablespace OLAP end backup;
alter system switch logfile;
exit
~
~

#/bin/bash
compress /u01/d01/archivelog/*.dbf

#!/bin/bash
. /u01/d01/jtlproddb/9.2.0/JTLPROD_jtlprod.env
sqlplus system/manager @/u01/d01/backupscripts/beginbackup.sql
cd /u01/d01
NOWDATE=`date +%d-%m-%y-%H_HOT`
export NOWDATE
tar cf - jtlproddata | gzip -c > /u01/d01/hotbackup/$NOWDATE.tgz
. /u01/d01/jtlproddb/9.2.0/JTLPROD_jtlprod.env
sqlplus system/manager @/u01/d01/backupscripts/endbackup.sql

No comments:

Post a Comment