• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1595
  • Last Modified:

scripts to delete rman backups after 7 days

I am running an rman backup scheme with a level "0" incremental backup on Sunday and level "1" incremental throughout the week in a unix enviroment (oracle 9i).  However I don't have enough space to hold and addtional level "0" on the next Sunday.  Is there a script in RMan to delete the previous level 0 backups prior to starting my backup on Sunday?
0
dedean01
Asked:
dedean01
  • 2
2 Solutions
 
MikeOM_DBACommented:

No, you need to code a shell script (ksh, bash) to remove the old backups kinda like this:

# -------------------------------------------------------
# Remove old backup files
# -------------------------------------------------------
cd /path/to/backup/files
for typ in arc ctl dbf
do
  find . -name "${sid}_${INCR_LVL}_${typ}_*" -mtime +1 -exec rm {} \;
  find . -name "${sid}_${INCR_LVL}_${typ}_*" -mtime  1 -exec rm {} \;
done


0
 
MikeOM_DBACommented:
PS: change +1 to +6 :
# -------------------------------------------------------
# Remove old backup files
# -------------------------------------------------------
cd /path/to/backup/files
for typ in arc ctl dbf
do
  find . -name "${sid}_${INCR_LVL}_${typ}_*" -mtime +6 -exec rm {} \;
done

0
 
dedean01Author Commented:
Thanks,
The command worked as expected. I also ran a Cross check in Rman to resync the rman catalog.
0
 
TintinCommented:
Note than in 10G, RMAN looks after deleting old files.
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now