RMAN - 常用的备份脚本

0级全库备份脚本

$ vi BackupFull.sh

BackupFull.sh文件的内容为:

复制代码
# script .:BackupFull.sh

# creater:leon_lan

# date:2012/7/22

# desc: backup full database datafile in archive with rman

# connect database

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

Export ORACLE_SID=oms

Export PATH=$ORACLE_HOME/bin:$PATH

Rman target/ << EOF_RMAN

Run{

       Allocate channel c1 type disk;

       Backup incremental level 0 tag ‘db0’ format

       ‘/u01/app/oracle/RmanBackup/db0_%d_%T_%s’ database include current controlfile;

       Delete noprompt obsolete;

       Release channel c1;

}

#end
复制代码

1级增量备份脚本

$ vi Incr1.sh

Incr1.sh文件的内容为:

复制代码
# script .:BackupFull.sh

# creater:leon_lan

# date:2012/7/22

# desc: backup full database datafile in archive with rman

# connect database

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

Export ORACLE_SID=oms

Export PATH=$ORACLE_HOME/bin:$PATH

Rman target/ << EOF_RMAN

Run{

       Allocate channel c1 type disk;

       Backup incremental level 1 tag ‘db1’ format

       ‘/u01/app/oracle/RmanBackup/db1_%d_%T_%s’ database include current controlfile;

       Delete noprompt obsolete;

       Release channel c1;

}

#end
复制代码

设置自动化执行备份脚本

复制代码
$ crontab –e

0 1 * * 0 /u01/app/oracle/RmanBackup/BackupFull.sh

>>/u01/app/oracle/RmanBackup/BackupFull.log

0 1 * * 3 /u01/app/oracle/RmanBackup/BackupFull.sh

>>/u01/app/oracle/RmanBackup/BackupFull.log

30 1 * * 1-2 /u01/app/oracle/RmanBackup/Incr1.sh

>>/u01/app/oracle/RmanBackup/Incr.log

30 1 * * 4-6 /u01/app/oracle/RmanBackup/Incr1.sh

>>/u01/app/oracle/RmanBackup/Incr.log
复制代码

上面的内容的意思是周日和周三凌晨1:00执行0级全库备份,周一、二、四、五六凌晨1:30执行1级增量备份。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值