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