RMAN Backup
#!/bin/sh find /findata/backup/PROD/RMAN/ -type d -mtime +3 -exec rm -rf {} \; log=/findata/backup/PROD/RMAN/`date +%Y%m%d`/`date +%Y%m%d`.log mkdir /findata/backup/PROD/RMAN/`date +%Y%m%d` chmod 777 /findata/backup/PROD/RMAN/`date +%Y%m%d` su - oracle -c " . /finsys/db/tech_st/11.1.0/PROD_ofprod.env rman <<EOF connect target / RUN { ALLOCATE CHANNEL ch1 TYPE DISK FORMAT '/findata/backup/PROD/RMAN/%T/%d_DB_%u_%s_%p'; ALLOCATE CHANNEL ch2 TYPE DISK FORMAT '/findata/backup/PROD/RMAN/%T/%d_DB_%u_%s_%p'; ALLOCATE CHANNEL ch3 TYPE DISK FORMAT '/findata/backup/PROD/RMAN/%T/%d_DB_%u_%s_%p'; ALLOCATE CHANNEL ch4 TYPE DISK FORMAT '/findata/backup/PROD/RMAN/%T/%d_DB_%u_%s_%p'; BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE ; backup archivelog FROM time 'sysdate-1' FORMAT '/findata/backup/PROD/RMAN/%T/%d_Archivelog_%u_%s_%p'; BACKUP CURRENT CONTROLFILE FORMAT '/findata/backup/PROD/RMAN/%T/%d_Controlfile_%u_%s_%p'; RELEASE CHANNEL ch1; RELEASE CHANNEL ch2; RELEASE CHANNEL ch3; RELEASE CHANNEL ch4; #crosscheck backup; #crosscheck archivelog all; #DELETE NOPROMPT ARCHIVELOG ALL completed before 'sysdate - 1'; #delete NOPROMPT obsolete redundancy 1; #DELETE NOPROMPT EXPIRED BACKUP; }EXIT;" 2>&1 >> $log
Cold Backup
#!/bin/sh find /findata/backup/PROD -type d -mtime +5 -exec rm -rf {} \; mkdir /findata/backup/PROD/`date +%Y%m%d` log=/findata/backup/PROD/`date +%Y%m%d`/`date +%Y%m%d`.log tarlog=/findata/backup/PROD/`date +%Y%m%d`/tar_`date +%Y%m%d`.log echo "Running preclone for application tier on `date`" 2>&1 >> $log su - applmgr -c "perl /finsys/inst/apps/PROD_ofprod/admin/scripts/adpreclone.pl appsTier" 2>&1 >> $log echo "Stopping the application services on `date`" 2>&1 >> $log su - applmgr -c "sh /home/applmgr/stopAPPS.sh" 2>&1 >> $log echo "Running preclone for database tier on `date`" 2>&1 >> $log su - oracle -c "perl /finsys/db/tech_st/11.1.0/appsutil/scripts/PROD_ofprod/adpreclone.pl dbTier pwd=apps" 2>&1 >> $log echo "Stopping the database on `date`" 2>&1 >> $log su - oracle -c "sh /home/oracle/stopDB.sh" 2>&1 >> $log cd /findata/ tar -cvzf /findata/backup/PROD/`date +%Y%m%d`/findata_db_`date +%Y%m%d`.tar db 2>&1 >> $tarlog cd /finsys/ tar -cvzf /findata/backup/PROD/`date +%Y%m%d`/finsys_db_`date +%Y%m%d`.tar db 2>&1 >> $tarlog tar -cvzf /findata/backup/PROD/`date +%Y%m%d`/finsys_apps_`date +%Y%m%d`.tar apps 2>&1 >> $tarlog tar -cvzf /findata/backup/PROD/`date +%Y%m%d`/finsys_inst_`date +%Y%m%d`.tar inst 2>&1 >> $tarlog echo "Starting the database on `date`" 2>&1 >> $log su - oracle -c "sh /home/oracle/startDB.sh" 2>&1 >> $log echo "Starting the Application services on `date`" 2>&1 >> $log su - applmgr -c "sh /home/applmgr/startAPPS.sh" 2>&1 >> $log
stopAPPS.sh
. /finsys/apps/apps_st/appl/APPSPROD_ofprod.env cd $ADMIN_SCRIPTS_HOME ./adstpall.sh apps/apps
stopDB.sh
. /finsys/db/tech_st/11.1.0/PROD_ofprod.env sqlplus / as sysdba <<EOF Shutdown immediate; EOF
startAPPS.sh
. /finsys/apps/apps_st/appl/APPSPROD_ofprod.env cd $ADMIN_SCRIPTS_HOME ./adstrtal.sh apps/apps
startDB.sh
. /finsys/db/tech_st/11.1.0/PROD_ofprod.env sqlplus / as sysdba <<EOF startup; EOF
No comments:
Post a Comment