【错误更正】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;(使用此脚本会提示输入yes or no,造成自动删除失败)

delete noprompt obsolete;

#(不提示输入yes or no)
exit; 

EOF

3. 每天凌晨2点备份

crontab设值为

00 2 * * * /root/rmanbak.sh

 



你可能感兴趣的:(rman备份脚本)