Enable Flash Recovery Area In 11g

Posted: March 5, 2013 in FRA

Here are steps to enable the flash recovery area in 11g and then check the existing backup policy is working fine or not.
My goals are:

1) Eanble the flash recovery area
2) Enable the flashback logs for database
3) Only archive logs should go in flash recovery area

Till, now archives are getting generated on normal mountpoint on server. But, to implement the automatic deletion of archives
in physical standby environment, it required to setup FRA at PROD as well as standby site. I will come to standby part in next
post. For this post, i will only be doing FRA implement on PROD.

Currently, archives are generated on normal disk location.


SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u05/oradata/CORE/
Oldest online log sequence 2088
Next log sequence to archive 2090
Current log sequence 2090


SQL> alter system set db_recovery_file_dest_size=10g scope=both;

System altered.

SQL> alter system set db_recovery_file_dest='/u05/oradata/CORE' scope=both;

System altered.

Now, i have enabled the FRA by setting above two parameters. Both parameters are dynamic and doesn’t require a database restart.
Enable database flashback logs as:


SQL> alter database flashback on;

Database altered.

Now, change the location of archive logs, so that archives now generated in FRA.

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CORE' scope=both;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2089
Next log sequence to archive 2091
Current log sequence 2091
SQL>
SQL>

Now, if i go to FRA location, i will see the directory structure as:


/u05/oradata/CORE
oracore@cph-core-db01-s $ ls -lrt
total 40
drwxr-xr-x 2 oracore oinstall 256 Mar 29 2012 lost+found
drwxr-x--- 4 oracore oinstall 256 Mar 5 11:35 CORE

A new folder will be created with database name (CORE is DB name in my case). If i go to core, i will see following:

oracore@cph-core-db01-s $ cd CORE
oracore@cph-core-db01-s $ ls -lrt
total 0
drwxr-x--- 2 oracore oinstall 256 Mar 5 11:32 flashback
drwxr-x--- 3 oracore oinstall 256 Mar 5 11:35 archivelog

flashback : This will contain the file (.flb) containing the flashback logs for database.

archivelog: This will conatin the archivelogs generated in OMF format and a new folder will be creates automatically
for daily archives.

Apart from these folders, few more folders will be created depending upon you put backups in FRA or not.

backupset: This will contain the RMAN backup files.

datafile : This will contain the image copies backups.

autobackup: This will contain the controlfile autobackup.

controlfile: This will contain the controlfile, if you put one of the controlfiles in FRA

onlinelogs : This will contain online redo log member, if one member is put in FRA.

Now, when i switch logfile, archive got generated in FRA and parameter log_archive_format has no effect on file name
generated in FRA.


SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2089
Next log sequence to archive 2091
Current log sequence 2091
SQL>

I checked the backup policy for archives, which says archive backedup 2 times should be deleted and this is
working fine after implementation of FRA too. No need to say that other backups L0 & L1 also ran fine.


RMAN> RUN {
2> ALLOCATE CHANNEL ch1 TYPE DISK;
3> sql 'alter system archive log current';
4> BACKUP FORMAT '/oraclebackup/CORE/ARC_1HR_%d_%D%M%Y_%u_%s_%p' ARCHIVELOG ALL NOT BACKED UP 2 TIMES TAG ='ARC_1HR';
5> DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE DISK;
RELEASE CHANNEL ch1;
6> 7> }

allocated channel: ch1
channel ch1: SID=223 device type=DISK

sql statement: alter system archive log current

Starting backup at 05-MAR-13
current log archived
channel ch1: starting compressed archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2095 RECID=3426 STAMP=809266809
input archived log thread=1 sequence=2096 RECID=3427 STAMP=809266816
input archived log thread=1 sequence=2097 RECID=3428 STAMP=809266821
input archived log thread=1 sequence=2098 RECID=3429 STAMP=809266882
input archived log thread=1 sequence=2099 RECID=3430 STAMP=809266883
input archived log thread=1 sequence=2100 RECID=3431 STAMP=809266917
input archived log thread=1 sequence=2101 RECID=3432 STAMP=809266918
channel ch1: starting piece 1 at 05-MAR-13
channel ch1: finished piece 1 at 05-MAR-13
piece handle=/oraclebackup/CORE/ARC_1HR_CORE_05032013_6mo3orn7_214_1 tag=ARC_1HR comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-MAR-13

RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2098_8mco9l5v_.arc thread=1 sequence=2098
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2099_8mco9m9k_.arc thread=1 sequence=2099
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2100_8mcobobl_.arc thread=1 sequence=2100
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2101_8mcobpc2_.arc thread=1 sequence=2101
List of Archived Log Copies for database with db_unique_name CORE
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
757680 1 2095 A 05-MAR-13
Name: /u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2095_8mco7921_.arc

757684 1 2096 A 05-MAR-13
Name: /u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2096_8mco7jkw_.arc

757689 1 2097 A 05-MAR-13
Name: /u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2097_8mco7o0z_.arc

deleted archived log
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2095_8mco7921_.arc RECID=3426 STAMP=809266809
deleted archived log
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2096_8mco7jkw_.arc RECID=3427 STAMP=809266816
deleted archived log
archived log file name=/u05/oradata/CORE/CORE/archivelog/2013_03_05/o1_mf_1_2097_8mco7o0z_.arc RECID=3428 STAMP=809266821
Deleted 3 objects

released channel: ch1

RMAN> exit

Advertisements
Comments
  1. Max says:

    Nice breakdown of the steps involved.

    I would like to find out if there would be any difference should i want to use the existing archive directory for the FRA?

    • orasteps says:

      There is no difference if you are using your regular archive location as FRA or any other location. It should be visible location on server with write permission

  2. viswa says:

    thank you orasteps it’s very help full for me..nice and clarity technical explanation

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