日期:2014-05-16  浏览次数:20508 次

oracle 备份: 每天备份,全备份,保留七天。

1. 保留七天

只保留七天的备份是这样设置的

RMAN> connect target/

 

connected to target database: DBSID (DBID=3100778490)

RMAN> configure retention policy to recovery window of 7 days; 

2. 备份脚本

vi /root/rmanbak.sh

#! /bin/bash

su - oracle <<!

rman target /<<EOF

backup AS COMPRESSED BACKUPSET   database

include current controlfile format '/orabak/db_%d_%T_%s'

plus archivelog format '/orabak/arch_%d_%T_%s' ;

delete obsolete;

exit; 

EOF

3. 每天凌晨2点备份

crontab设值为

00 2 * * * /root/rmanbak.sh