暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
RMAN备份脚本
1536
3页
18次
2019-09-30
10墨值下载
--每周日凌晨3点全备,其他时间每半小时备份一次归档,备份文件保留两
[oracle@DB01 backup]$ crontab -l
0 3 * * 0 /home/oracle/backup/full_backup.sh
0,30 */1 * * * /home/oracle/backup/arch_backup.sh
14,30 */24 * * * find /oradata/rman_backup -mtime +14 |xargs rm -rf
[oracle@DB01 backup]$ cat /home/oracle/backup/arch_backup.sh
#!/bin/sh
#Full Archive Backup Script
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db2
export DBNAME=db
export PATH=$ORACLE_HOME/bin:$PATH
year=`date "+%Y"`
month=`date "+%m"`
day=`date "+%d"`
hour=`date "+%H"`
min=`date "+%M"`
sec=`date "+%S"`
bakdate=$year$month$day
baktime=$hour$min$sec
BACKUP_DIR=/oradata/rman_backup/$bakdate
SCRIPT_DIR=/home/oracle/backup
CMDFILE=$SCRIPT_DIR/arch_backup.rman
LOGFILE=$SCRIPT_DIR/log/arch/${bakdate}_${baktime}_arch.log
mkdir $BACKUP_DIR
cd /home/oracle
>$CMDFILE
cat <<EOF >>$CMDFILE
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
allocate channel ch5 device type disk;
allocate channel ch6 device type disk;
sql 'alter system checkpoint';
sql 'alter system switch logfile';
sql 'alter system archive log current' ;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '${BACKUP_DIR}/${DBNAME}_ctl_orcl1.f';
backup as compressed backupset
filesperset 10
format '${BACKUP_DIR}/${DBNAME}_arch_%s_%p_%T'
archivelog all not backed up 2 times ;
delete noprompt ARCHIVELOG UNTIL TIME 'SYSDATE-6';
backup format '${BACKUP_DIR}/${DBNAME}_ctl_%U.%T' current controlfile;
release channel ch1;
release channel ch2;
release channel ch3;
RMAN备份脚本
2019911
15:09
分区 RMAN备份脚本 的第 1
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
EOF
rman target / log=${LOGFILE} < $CMDFILE
[oracle@DB01 backup]$ cat /home/oracle/backup/full_backup.sh
#!/bin/sh
#Full Database Backup Script
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db2
export DBNAME=db
export PATH=$ORACLE_HOME/bin:$PATH
year=`date "+%Y"`
month=`date "+%m"`
day=`date "+%d"`
hour=`date "+%H"`
min=`date "+%M"`
sec=`date "+%S"`
bakdate=$year$month$day
baktime=$hour$min$sec
BACKUP_DIR=/oradata/rman_backup/$bakdate
SCRIPT_DIR=/home/oracle/backup
CMDFILE=$SCRIPT_DIR/full_backup.rman
LOGFILE=$SCRIPT_DIR/log/${bakdate}_${baktime}_full.log
mkdir $BACKUP_DIR
cd /home/oracle
>$CMDFILE
cat <<EOF >>$CMDFILE
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
allocate channel ch4 device type disk;
allocate channel ch5 device type disk;
allocate channel ch6 device type disk;
sql 'alter system checkpoint';
sql 'alter system switch logfile';
sql 'alter system archive log current' ;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '${BACKUP_DIR}/${DBNAME}_ctl_orcl1.f';
crosscheck backup;
delete noprompt expired backup;
backup as compressed backupset
full database
filesperset 10
format '${BACKUP_DIR}/${DBNAME}_full_%u_%p_%T'
plus archivelog format '${BACKUP_DIR}/${DBNAME}_plus_arch_%u_%p_%T';
backup format '${BACKUP_DIR}/${DBNAME}_ctl_%U.%T' current controlfile;
backup spfile format '${BACKUP_DIR}/${DBNAME}_spfile_%U.%T';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
分区 RMAN备份脚本 的第 2
of 3
10墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜