Oracle RMAN 11g Backup and Recovery (137 page)

BOOK: Oracle RMAN 11g Backup and Recovery
8.64Mb size Format: txt, pdf, ePub

SQL> select * from v$recovery file dest;

NAME SPACE SPACE SPACE NUM

LIMIT USED RECLAIMABLE FILES

c:\oracle\flash recovery area 3,221,225,472 934,699,008 23,445,504 17

In this case, we find that about 23MB of space is reclaimable. RMAN will clear these files once there is a need for the free space. If we were to find that the amount of used space is quite high and the amount of reclaimable space is low, we may have underallocated the amount of space to the FRA. If you find the amount of reclaimable space is quite high, then you might want to review your retention criteria and make sure they are set correctly. You will also want to make sure you have not overallocated space to the FRA.

If you see that you have space being allocated to obsolete backup sets, you can use the RMAN
report obsolete
command to see details of the obsolete backups, as seen here: RMAN> report obsolete;

Chapter 16: Maintaining RMAN
407

using target database control file instead of recovery catalog

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 2

Report of obsolete backups and copies

Type Key Completion Time Filename/Handle

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

Backup Set 61 08-SEP-09

Backup Piece 71 08-SEP-09

/oracle/app/oracle/flash recovery area/ROB1/autobackup/2009 09 08

/o1 mf s 697001330 5bd8ylgv .bkp

Retention Policy Maintenance When Using a Manual Backup Location
If you are not using the FRA, you are backing up to a manual backup location. In this case, you will need to manage the expired backups a little differently. As with the FRA, once a backup is no longer needed, RMAN will mark the backup or copy as OBSOLETE. You can determine which backups RMAN

has marked as OBSOLETE with the
report obsolete
command (we will look at the
report
command in the next chapter):

report obsolete;

In the case of a manual backup area, you will need to perform one more step to get RMAN

to remove the obsolete backups. This extra step is the execution of the
delete obsolete
command.

This command tells RMAN to physically delete the backup on physical disk. It will also mark the metadata related to the backup in the control file as deleted, and it will remove all records associated with the backup in the recovery catalog.

Retention Policy Maintenance When Using the Flash Recovery Area
Of course, you might take a backup and decide that you want to change its retention policy. In this event, you would use the RMAN
change
command with the
keep
parameter to change the retention policy of the backup you want to retain. When you use this command, the backups or copies impacted are considered to be
long-term backups
and are not subject to the chosen retention policy.

In Oracle Database 11
g,
the
change
command modifies a backup so that it becomes an archival backup (discussed first in Chapter 11). The resulting archival backup can be retained forever (this requires a recovery catalog), or you can define a new date where the archival backup should later be made obsolete by RMAN (if the retention date is greater than 365 days from now, you will need a recovery catalog). With an archival backup, the related archived redo log backups are also preserved and will be marked obsolete at the time indicated (assuming they are not needed for another archival backup). Here is an example of using the
change
command in Oracle Database 11
g
to create an archival backup:

NOTE

If you are using a flash recovery area, you cannot use the
keep forever
clause of the
keep
command.

-- Run the list backup command to get the backup key we need

-- This is just a partial listing of the list backup output

-- We bolded the backup set key values that we will be using.

RMAN> list backup;

408
Part III: Using RMAN Effectively

List of Backup Sets

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

267
Full 1.09G DISK 00:06:50 12-FEB-10

BP Key: 200 Status: AVAILABLE Compressed: NO Tag:

TAG20100212T121310

Piece Name: C:\ORACLE\FLASH RECOVERY AREA\CLASS\BACKUPSET\2010 02 12\

O1 MF NNNDF TAG20100212T1

21310 5QCB274D .BKP

List of Datafiles in backup set 3

-- change a backup so it will be retained forever. 267 is the backup key

-- that we get from the list backup RMAN command

-- Change backup 267 from an obsolete status to a keep status.

-- Note that this command requires a recovery catalog

change backupset 267 keep forever;

-- change a backup so it will be kept for 7 more days

change backupset 267 keep until time 'sysdate + 7' logs;

-- Obsolete a backup

change backupset 33 nokeep;

In versions of Oracle before Oracle Database 11
g,
the
change
command will change the retention criteria as stated previously. These are not considered archival backups, though, and as a result, the archived redo logs are not automatically preserved. To ensure the backup will always be recoverable to the current point in time (but consider the impact that this might have on storage), you will need to use the
keep logs
parameter to make sure the retention criteria of archived redo log backups is also modified, as seen in this example:

change backupset 267 keep forever logs;

When you change a backup or copy, you have to reference the key that is associated with that backup. As you can see from the previous example, you find this key by using the
list backup
or
list copy
command (in our case, we use backup set key 267), each of which is described in the next chapter. Note that the
keep forever
option has some restrictions. First, it’s only available if you are using a recovery catalog in any versions. Second, in any version prior to Oracle Database 11
g,
the
keep forever
option is not available if you are using the FRA.

Once you have reviewed the report, you can direct RMAN to actually remove the backups with the RMAN
delete
command with the
obsolete
parameter:

delete obsolete;

The change Command

We introduced the
change
command earlier in this chapter and explained how it can be used to modify the retention window assigned to a specific backup. The
change
command allows you to change the status of a backup. You might have a case where one of your backup media devices becomes unavailable for a period of time (perhaps someone spilled a drink down the power supply). In this event, you can use the
change
command to indicate that the backups on that device are unavailable.

Other books

Monarch Beach by Anita Hughes
The Dorset House Affair by Norman Russell
In Memoriam by Suzanne Jenkins
The Golden Shield of IBF by Jerry Ahern, Sharon Ahern
Innocence Lost by T.A. Williams
Hope for Us (Hope Series Book #3) by Michelle, Sydney Aaliyah
Little Rainbows by Helena Stone
Falling in Love by Stephen Bradlee