Oracle RMAN 11g Backup and Recovery (85 page)

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

You use the
configure
command to configure an archive log deletion policy. The retention policy exists for all archived redo logs, including those in the FRA. RMAN will automatically delete archived redo logs in the FRA, but you will need to manually remove obsolete archived redo logs from other directories with the
delete obsolete
command if you are not using the FRA.

The archived redo log deletion policy is determined based on how many times an archived redo log is actually backed up by RMAN. By default, the archive log deletion policy is set to a value of none, which means you will need to handle the removal of archived redo logs yourself (for example, during a backup using the RMAN
delete input
command). If you wanted to ensure

Chapter 11: RMAN Backups
243

that at least two backups of an archived redo log occur and that the archived redo log would be marked obsolete, you could issue the following
configure
command: Configure archivelog deletion policy to backed up 2 times to device type disk; Note that logs subject to standby database–related retention policies are not subject to this retention policy. Also note that Oracle will not immediately remove archived redo logs when they become obsolete. Instead, the obsolete archived redo logs will be removed as space in the FRA is exhausted. As a result, archived redo logs will remain in the FRA as long as possible.

Overriding the configure exclude Command

You can configure RMAN to exclude from your backups any datafiles that have not changed since the last backup, by issuing the
configure exclude
command (discussed in Chapter 3). If you want to ensure that RMAN backs up these datafiles, you can include the
noexclude
parameter in the
backup
command as follows:

backup database noexclude keep forever tag 'test backup';

Checking the Database for Errors with the backup Command

Another handy RMAN feature is the ability to use RMAN to actually scan the database for physical and logical errors without actually doing a backup. This is facilitated through the use of the
validate
parameter of the
backup
command along with the use of the
check logical
option.

Here is an example of the use of this option:

backup validate check logical database;

NOTE

Even though some of the text generated during an RMAN
validate
run will make it look like a backup set is being created, this is not
the case. No RMAN backup file pieces will be generated during the

validate
run.

Skipping Offline, Inaccessible, or Read-Only Datafiles

Sometimes, you will have a datafile in your database that has a status other than ONLINE. In the case of read-only datafiles, you may not want to back them up every time you do a backup of the database. In the case of offline or inaccessible datafiles, RMAN backups will fail if you don’t do something to indicate to RMAN to skip the missing datafiles. This is what the
skip
parameter is used for. You can skip offline, read-only, or inaccessible datafiles (or all three) as required. Here are some examples of how to do this:

backup database skip readonly;

backup database skip offline;

backup database skip inaccessible;

backup database skip readonly skip offline skip inaccessible;

The
inaccessible
parameter causes Oracle to skip files that cannot be read at all. These files are not physically on the disk (for example, if the datafiles have been deleted from the disk or moved to another location). Datafiles that are offline but physically still in place are skipped using

244
Part II: Setup Principles and Practices

the
offline
parameter. Finally, the
skip readonly
parameter is used to cause Oracle to skip backing up a read-only datafile. Of course, you can use the
configure
command to indicate that Oracle should not back up read-only tablespaces at all, which leads us to our next section.

NOTE

In previous versions of Oracle Database, RMAN could not back up

a transportable tablespace that was still read-only. Starting in Oracle
Database 11
g
, this is no longer the case, and you can use RMAN to
back up a transportable tablespace when it’s still in read-only mode.

Forcing a Backup of Read-Only Datafiles

In the preceding section, we showed you how to cause a backup to skip read-only datafiles, but this can be a bit tedious. Oracle offers backup optimization to make life a bit easier. We talked about backup optimization in Chapter 3 in association with the
configure
command. Backup optimization causes RMAN to not back up unchanged tablespaces (for example, read-only tablespaces) by default. If you want a specific backup to be forced to ignore that configuration setting, you can use the
force
parameter to ensure that all datafiles are backed up. Here is an example:

backup database force;

Backing Up Datafiles Based on Their Last Backup Time

Oracle allows you to indicate in your backup process if you prefer to only back up database datafiles that have not been backed up since a given time. This is handy if you have added new datafiles (as we discuss first in this section), or if you only want to back up datafiles that have changed in a given number of days. Let’s look at each of these choices in a bit more detail.

Other books

A Just Cause by Sieracki, Bernard; Edgar, Jim;
The Magic Wakes by Bradford, Charity
Short Cuts by Raymond Carver
Dangerous to Know by Katy Moran
Midu's Magic by Judith Post
Calendar Girl by Marsden, Sommer
To Steal a Prince by Caraway, Cora
Ruthless Game by Christine Feehan