Oracle Technologies Blog

By ASKM

RMAN KEEP FOREVER ( NO-EXPIRE ) backups to tape

Posted by Srikrishna Murthy Annam on June 20, 2011

In this article, i am going to present two different type of backups to keep forever which exempts them from the retention policy

In the present article, i am going to present the scripts  to backup the database which are exempted from the retention policy and can be kept forever in the  storage. These type of backups will be done immediately after certifying any training instances to refresh every week. One backup will be kept forever with no expire option and the same backup will be used to refresh the database every time.

We can have either consistant backup and in-consistant backups. Consistant backups need the database in mount stage and we can backup database with nologs option. We dont need any archive logs to recover database.
In-consistant backups are done when the database is up and running. And if we have these backups with keep forever option, we may need to keep all the archive log backups taken after the KEEP FOREVER backups were taken.

From 11g onwards, KEEP FOREVER option is improved and it only retains the archivelogs which are required to keep the online backup consistent.

FOREVER Consistant Backups:

startup mount;
run
{
allocate channel t1 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
allocate channel t2 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
allocate channel t3 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
backup as compressed backupset check logical incremental level 0 database format 'backup_%d_%I_set%s_piece%p_copy%c_%T_%U' TAG=NOEXPIRE keep forever nologs;
backup current controlfile TAG=NOEXPIRE;
backup spfile TAG=NOEXPIRE;
delete obsolete;
}

FOREVER Backups with DB up:

First backup all the archive logs using
backup archivelog all;
Then execute the script :
run
{
allocate channel t1 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
allocate channel t2 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
allocate channel t3 type 'SBT_TAPE' parms="ENV=(TDPO_OPTFILE=/opt/app/oracle/oradba/rman/tdpo/tdpo.opt)";
backup as compressed backupset check logical incremental level 0 database format 'backup_%d_%I_set%s_piece%p_copy%c_%T_%U' plus archivelog TAG=NOEXPIRE keep forever logs;
backup current controlfile TAG=NOEXPIRE;
backup spfile TAG=NOEXPIRE;
delete obsolete;
}

Hope it helps
SRI

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: