Thursday, December 17, 2009

Creating a Disk only backup script to achieve a recovery window using oracle recommended strategy in flash recovery area


Subject:
Creating a Disk only backup script to achieve a recovery window using oracle recommended strategy in flash recovery area

Note:280709.1
Type:
BULLETIN

Last Revision Date:
21-SEP-2004
Status:
PUBLISHED
 
***
This article is being delivered in Draft form and may contain
errors.  Please use the MetaLink "Feedback" button to advise
Oracle of any issues related to this article.
***
 
PURPOSE
-------
 
To understand and using oracle recommended strategy for disk only backups
to achieve a recovery window of N days. This note is essentially written 
to clarify bug# 3826979.
 
 
SCOPE & APPLICATION
-------------------
All users of RMAN that have the need of backing up the database to disk only 
and may use flash recovery area.
 
Topics discussed
----------------
 
1. Disk backup strategy
2. How to obtain recovery window of N days using disk backup strategy?.
 
 
1.Disk Backup Strategy
----------------------
Oracle recommended disk backup strategy is to have
  a) retention policy is redundancy 1
  b) create a copy of database on disk in flash recovery area
  c) take cumulative incrementals over this copy
  d) rollforward the copy of database daily
 
  a) RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
  b, c & d)
  The backup script is like
  run {
     recover copy of database with tag ORA_BACKUP;
     backup device type disk 
     incremental level 1 for recover of copy database with TAG ORA_BACKUP;
  }
 
  The first command roll forwards the copy of database with tag ORA_BACKUP
  to latest point in time by applying incrementals over the backup.
  
  The second command creates an incremental backup with parent as copy of
  database with tag ORA_BACKUP. If there is no copy of database with tag
  ORA_BACKUP, then it will create a copy. 
 
  Timeline      first command                       second command
  ========      =============                       ==============
  Day 1         no copy of rollforward              creates a copy of database
  Day 2         no incr to be applied               creates incremental
  Day 3         copy roll forwarded through Day2    creates incremental
  Day 4         copy roll forwarded through Day3    creates incremental
  ...
 
  As you can see that the above script will make the copy one day older at given time.
  Hence, the script is good to attain a recovery window of 1 days assuming the script
  is executed every night.
 
2. How to obtain recovery window of N days using disk backup strategy?.
-----------------------------------------------------------------------
  Now instead of attaining 1 day recovery window on disk, user may wish to
  achieve a recovery window of N days. For example, assume user want a 
  recovery window of 15 days.
 
  There are two changes that needed to be done -
  a) change retention policy to recovery window of 15 days;
  b) change backup script to keep copy 15 days older
 
  a) RMAN> configure retention policy to recovery window of 15 days;
     This configuration is optional. We can obtain recovery window of 15 days
     with redundancy 1 and using below script. The advantage of changing the
     configuration is to make sure that RMAN doesn't mark any tape backups
     (if any) as obsolete that are require to attain 15 day recovery window.
 
  b) The backup script is like
     run {
        recover copy of database with tag ORA_BACKUP until time 'sysdate - 16';
        backup device type disk 
        incremental level 1 for recover of copy database with TAG ORA_BACKUP;
     }
 
     We use one day more as 'sysdate-16' to take care of daylight savings.
 
  The first command roll forwards the copy of database with tag ORA_BACKUP
  to a point in time 16 days older by applying incrementals over the backup.
  
  The second command creates an incremental backup with parent as copy of
  database with tag ORA_BACKUP. If there is no copy of database with tag
  ORA_BACKUP, then it will create a copy. 
 
  Timeline      first command                       second command
  ========      =============                       ==============
  Day 1         no copy of rollforward              creates a copy of database
  Day 2         no incr to applied                  creates incremental
  ...
  Day 15        no incr to applied                  creates incremental
  Day 16        copy roll forwarded through Day2    creates incremental
  Day 17        copy roll forwarded through Day3    creates incremental
  ...
 
  As you can see you can achieve a recovery window of 15 days on disk.

No comments:

Post a Comment