[oracle@BossServerA ~]$ crontab -l
30 3 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 * * /rmanback/SMSdg/dbbackup/rman_bk.sh
30 1 27 * * /opt/oracle/product/any.sh
30 4 * * * /bossdata/clean_arch.sh
1:
[oracle@BossServerA ~]$ more /rmanback/SMSdg/dbbackup/rman_bk.sh
#!/bin/bash
. /home/oracle/.bash_profile
echo "Backup Beginning time:" `date +'%Y-%m-%d %H:%M'`
env
dir_data=`/bin/awk '{print $1}' /rmanback/SMSdg/dbbackup/last_dir`
if [ "$dir_data" == "u01" ]
then
/opt/oracle/product/10.2/bin/rman target / nocatalog log=/rmanback/SMSdg/dbbackup/log.rman @/rmanback/backup_s.rman
cp /opt/oracle/product/10.2/dbs/lkSTARBOSS* /rmanback/u01/rmanbackup/dbs_s/.
cp /opt/oracle/product/10.2/dbs/orapwstarboss /rmanback/u01/rmanbackup/dbs_s/.
echo "u02" > /rmanback/SMSdg/dbbackup/last_dir
else
/opt/oracle/product/10.2/bin/rman target / nocatalog log=/rmanback/SMSdg/dbbackup/log.rman @/rmanback/backup_d.rman
cp /opt/oracle/product/10.2/dbs/lkSTARBOSS* /rmanback/u02/rmanbackup/dbs_d/.
cp /opt/oracle/product/10.2/dbs/orapwstarboss /rmanback/u02/rmanbackup/dbs_d/.
echo "u01" > /rmanback/SMSdg/dbbackup/last_dir
fi
echo "Backup End time:" `date +'%Y-%m-%d %H:%M'`
2:
[oracle@BossServerA ~]$ more /rmanback/backup_s.rman
report obsolete;
delete noprompt obsolete;
run{
allocate channel d1 type disk MAXPIECESIZE 2000M;
allocate channel d2 type disk MAXPIECESIZE 2000M;
allocate channel d3 type disk MAXPIECESIZE 2000M;
allocate channel d4 type disk MAXPIECESIZE 2000M;
backup filesperset 8 database tag bbbossdb_s include current controlfile format '/rmanback/u01/rmanbackup/backup_s/bossdb%d%U.dbf.%T';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup filesperset 20 format '/rmanback/u01/rmanbackup/dbs_s/bossdblog_t%t_s%s_p%p' archivelog all;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
delete archivelog until time 'sysdate-3';
quit
3:
[oracle@BossServerA ~]$ more /opt/oracle/product/any.sh
sqlplus /nolog @/opt/oracle/product/analyze.sql
4:
[oracle@BossServerA ~]$ more /bossdata/clean_arch.sh
find /bossdata/Archive_log/ -name "*.dbf" -mtime 20 -exec rm {} \;
阅读(540) | 评论(0) | 转发(0) |