Oracle RMAN 11g Backup and Recovery (39 page)

The FRA helps with the management of overall disk space allocation and provides a centralized storage area for all recovery-related files.

Retention of files in the FRA is determined by the RMAN retention policy. This is set via the RMAN
configure retention policy
command. This command and RMAN retention will be discussed in much more detail later in this chapter. If a file does not have a retention policy associated with it or it’s a permanent file, then it will never be deleted. If a file is not yet obsolete under the RMAN retention policy, then it will not be deleted. Finally, archived logs are eligible for deletion once they are obsolete.

The FRA is created in a specific location defined by the parameter DB_RECOVERY_FILE_DEST.

This location can be a file system or an ASM volume. You define the quota of space allocated to the database’s FRA by using the DB_RECOVERY_FILE_DEST_SIZE parameter. This is a logical, database-specific, Oracle-controlled file space limitation, independent of the overall space available in the file system itself. Oracle monitors the space available in the FRA used by the database, and once the amount of available space in the FRA starts to diminish to unsafe levels, Oracle generates a warning in the alert log. In Oracle Database 11
g,
these warnings occur when reclaimable space is less than 15 percent of the DB_RECOVERY_FILE_DEST_SIZE value. A critical alert is also signaled when the database is at less than 3 percent of reclaimable space. These alerts appear in OEM, in the alert log, or you can review the DBA_OUTSTANDING_ALERTS table. Several views are available for you to reference when trying to determine if your flash recovery area is running out of space. We address those views later in this chapter in the section titled “Flash Recovery Area Views.”
NOTE

Running out of space in the FRA can be troublesome if that area is

your only archive log destination, as this can cause your database

to eventually halt. If the FRA is going to be your only archive log

destination, monitor space availability carefully.

Chapter 3: RMAN Setup and Configuration
65

File Type

Notes

Archived redo logs

Archived redo logs will be stored in the FRA.

Control file

One copy of the control file is created in the FRA when the

database is created.

Control file autobackups

The default location for the RMAN control file autobackups

will be the FRA, if it is defined.

Flashback logs

Flashback logs (discussed later in this chapter) will be stored in

the FRA, if it is defined.

Redo log

One copy of each redo log group member can be stored in the

FRA.

RMAN datafile copies

The default location for the RMAN datafile copies will be the

FRA, if it is defined.

RMAN backup and other

The default location for the RMAN files in general (backup set

related files

pieces, etc.) will be the FRA, if it is defined.

TABLE 3-1
File Types Found in the Flash Recovery Area

Figuring out how much space to allocate to the FRA can be a bit challenging. Typically you have to monitor space usage and adjust the size of the FRA as required. If the database already exists, you can review the amount of archive log space consumed by checking the DBA_HIST_

LOG view. This view derives its data from Oracle’s AWR infrastructure. It will tell you the average size of the archived redo logs and the time of the log switch. Here is an example of a query against the DBA_HIST_LOG view:

SQL> alter session set nls date format 'mm/dd/yyyy hh24:mi:ss';

Session altered.

SQL> select sequence#, first time Log started

2 ,lead(first time, 1,NULL) over (order by first time) Log ended

3 from (select distinct sequence#, first time

4 from dba hist log

5 where archived 'YES'

6 and sequence#! 0

7 order by first time)

8 order by sequence#;

SEQUENCE# LOG STARTED LOG ENDED

---------- ------------------- -------------------

82 05/18/2009 22:02:56 05/19/2009 12:52:06

83 05/19/2009 12:52:06 05/19/2009 22:01:24

84 05/19/2009 22:01:24 05/20/2009 15:25:39

85 05/20/2009 15:25:39 05/21/2009 10:00:58

86 05/21/2009 10:00:58 05/21/2009 17:02:00

87 05/21/2009 17:02:00 05/21/2009 22:01:28

88 05/21/2009 22:01:28

7 rows selected.

66
Part II: Setup Principles and Practices

Many large systems run more than one Oracle database. Each of these databases will use archive log storage space, and typically these archived redo logs will all be stored on the same file system. On occasion, a single database can consume all the space on that storage device.

This can impact all databases using that storage device, since they will no longer be able to create archived redo logs. One benefit of the FRA is that it provides the ability to allocate a specific space quota to each database. Thus, with an FRA, you can reduce the risk that one database will consume all archive log space and negatively impact other databases.

If you find that the FRA has run out of space, you can respond to the problem as follows:
1.
If the problem is one of insufficient space allocation via the parameter DB_RECOVERY_

FILE_DEST_SIZE and sufficient physical disk space exists to increase the space allocated to the FRA, increase the size of the parameter. This will immediately add space to the FRA. Of course, you cannot increase this parameter to a value that is greater than the amount of space that is physically available on the file system.

2.
If you need more physical space, allocate additional physical space to the file system, and then increase the size of the DB_RECOVERY_FILE_DEST_SIZE parameter.

3.
If additional space is not available, you can move the FRA to another file system where more space is available.

4.
You can also make room in the FRA by using the RMAN
backup recovery area
command to move the contents of the FRA to another location. We will cover the
backup recovery
area
command and its limitations during discussions on performing RMAN backups.

5.
As a last-ditch effort, physically remove older backup set pieces and/or archived redo logs from the FRA, and then use the RMAN
crosscheck
command to get the database to recognize that the files have been removed.

NOTE

If you find yourself queasy at the idea of removing physical files from
the FRA, then your gut instincts are good. Essentially this means either
that your retention policy is not correct or that you have not allocated
enough space to support the retention policy established for your

database. Also, removing files potentially compromises the recoverability
of your database, so exercise extreme caution when removing files.

Setting Up the Flash Recovery Area

To set up the FRA, you will want to configure the following parameters:

Parameter

DB_RECOVERY_FILE_DEST_SIZE

DB_RECOVERY_FILE_DEST

Example

Alter system set db recovery

Alter system set db recovery

file dest size 20G scope both;

file dest '/u01/oracle/

flash recovery' scope both;

Purpose

Sets the allocated size of the FRA, in

Specifies the location of the FRA. This

bytes, and must be defined in order

can be a file system, an ASM disk

to enable the FRA. This allows you

location, or an OMF location.

to control how much disk space is

allocated to the FRA.

You should not set this value to a size

greater than the total amount

of available disk space.

Chapter 3: RMAN Setup and Configuration
67

Note that you must specify the DB_RECOVERY_FILE_DEST_SIZE parameter before you specify the DB_RECOVERY_FILE_DEST parameter. Failure to do so will result in an ORA-32001

error message. In a similar fashion, you must disable the DB_RECOVERY_FILE_DEST parameter before you reset the DB_RECOVERY_FILE_DEST_SIZE parameter. Leaving DB_RECOVERY_FILE_

DEST empty will disable the FRA. Here is an example of disabling the FRA by resetting the DB_

RECOVERY_FILE_DEST parameter:

alter system set db recovery file dest ' ' scope both;

Oracle allows you to archive to both the FRA and to one or more additional locations through the use of the LOG_ARCHIVE_DEST_
n
parameters. One case when you would want to do this is if you were configuring standby databases and you still wanted to take advantage of the features of the FRA.

To configure both FRA and archive log destination directories, you set the standard FRA parameter DB_RECOVERY_FILE_DEST, defining the location of the FRA. You will also define the various LOG_ARCHIVE_DEST_
n
parameters that are required. By default, when a LOG_

ARCHIVE_DEST_n parameter is defined, that location will be used instead of the FRA. To get Oracle to use the FRA when a LOG_ARCHIVE_DEST_
n
parameter is set, you need to define an additional LOG_ARCHIVE_DEST_
n
parameter for the FRA. Typically, this will be LOG_ARCHIVE_

DEST_10, and you will use the Oracle-supplied constant USE_DB_RECOVERY_FILE_DEST to indicate that this destination is the FRA. Here is an example where we configure Oracle to use the FRA and a regular archive log destination directory:

alter system set log archive dest 10 'LOCATION USE DB RECOVERY FILE DEST'; alter system set log archive dest 1 'location c:\oracle\oraarc\beta1 mandatory'; In this example, the ARCH process will now create archived redo logs in both LOG_

ARCHIVE_DEST_1 and LOG_ARCHIVE_DEST_10, which is the FRA.

Flash Recovery Area Views

Several views are available to help you manage the FRA. These views include the following:

■ DBA_OUTSTANDING_ALERTS

Other books

Voice of the Undead by Jason Henderson
The Last Jews in Berlin by Gross, Leonard
No Time to Die by Kira Peikoff
Vintage Soul by David Niall Wilson
Sex and the Citadel by Shereen El Feki
Guilty by Norah McClintock
Bishop's Folly by Evelyn Glass
Pop Goes the Weasel by M. J. Arlidge