Windows环境下的Oracle数据库备份策略

 

最近公司一个新项目上线,服务器有限,无法搭建DG,特制定以下数据库备份策略:

1、每天凌晨1点进行数据库全库导出备份

代码清单:

expdp 数据库用户名/密码@IP地址/数据库实例名 schemas=模式名 directory=dumpdir dumpfile=备份文件.dmp version=11.1.0.7.0 logfile=备份文件名.log compression=all

PS:如果需要删除历史数据,可通过下列脚本:

del D:\backup\expdpbak\备份4.dmp 
rename D:\backup\expdpbak\备份3.dmp 备份4.dmp 
rename D:\backup\expdpbak\备份2.dmp 备份3.dmp 
rename D:\backup\expdpbak\备份1.dmp 备份2.dmp 
rename D:\backup\expdpbak\备份.dmp 备份1.dmp 
rename D:\backup\expdpbak\备份.log 备份1.log

2、每周一,周二,周三,周四,周五,周六进行RMAN增量备份

代码清单:

run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
sql "ALTER SYSTEM ARCHIVE LOG CURRENT";
backup incremental level=2 tag='db2' format 'D:\backup\rmanbak\db2%d_%T_%u'  database  plus archivelog  tag 'arch' format 'D:\backup\rmanbak\arch%T_%u_%s_%p';
crosscheck backup;
delete noprompt expired backup;
delete obsolete;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'trunc(sysdate-1)' backed up 1 times to device type disk;
delete noprompt expired archivelog all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

3、每周日进行RMAN全量备份

run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
configure retention policy to recovery window of 4 days;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to 'D:\backup\rmanbak\ctl_%F';

sql "ALTER SYSTEM ARCHIVE LOG CURRENT";
backup  as compressed backupset incremental level=0 tag='db0' format 'D:\backup\rmanbak\db0%d_%T_%u'  database  plus archivelog  tag 'arch' format 'D:\backup\rmanbak\arch%T_%u_%s_%p';
crosscheck backup;
delete noprompt expired backup;
delete obsolete;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'trunc(sysdate-1)' backed up 1 times to device type disk;
delete noprompt expired archivelog all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

4、每周日凌晨进行日志清理操作

代码清单:

crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'trunc(sysdate-2)';
crosscheck archivelog all;
delete noprompt expired archivelog all;

5、考虑到单点故障带来的风险,建议将备份文件定期拷贝至NAS存储设备

代码清单:

xcopy D:\backup\expdpbak\*.DMP  Z:\bak\ /d /y
xcopy D:\backup\expdpbak\*.log  Z:\bak\ /d /y
--------------------- 
作者:Almeche 
来源:CSDN 
原文:https://blog.csdn.net/ruoshuisanqian321/article/details/89555156 
版权声明:本文为博主原创文章,转载请附上博文链接!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值