Oracle RMAN 11g Backup and Recovery (88 page)

250
Part II: Setup Principles and Practices

just after you have made the tablespace read-only. To do a tablespace-level backup, simply use the
backup
command with the
tablespace
parameter:

backup tablespace users;

If you want to back up any archived redo logs at the same time, you could issue the command like this:

backup tablespace users plus archivelog;

Or perhaps you want to also make sure your current control file is backed up: backup tablespace users include current controlfile plus archivelog;

Of course, you are not really backing up a tablespace, but rather the datafiles associated with that tablespace. Oracle just converts the tablespace name into a list of datafiles that are associated with that tablespace. Normally, a control file backup will not occur during these backups unless you have configured automatic control file backups (refer to Chapter 3) to occur (and you are not backing up datafile 1). If you use the
include current controlfile
parameter, then the control file will be backed up.

NOTE

RMAN will not prevent you from doing a tablespace or datafile

backup in NOARCHIVELOG mode (as long as the database is not

open). However, these backups are not really all that usable when

the database is in NOARCHIVELOG mode (unless you back up all the

tablespaces and datafiles at the same time).

Datafile Backups

You might want to back up specific database datafiles. Perhaps you are getting ready to move them to a new device, and you wish to back them up before you move them. RMAN allows you to back up a datafile by using the
backup
command with the
datafile
parameter followed by the filename or number of the datafiles you wish to back up. The following are examples of some
backup datafile
commands:

backup datafile 2;

backup datafile 'd:\oracle\oradata\robt\users01.dbf';

backup datafile 'd:\oracle\oradata\robt\users01.dbf' plus archivelog;

Again, the control file and the SPFILE will get backed up if datafile 1 is backed up or if automated control file backups are configured. In the last example, the archived redo logs will get backed up as well.

Archived Redo Log Backups

For a number of reasons, you might well want to back up your archived redo logs but not the database. In this event, you use the
backup archivelog
command. To back up all of the archived redo logs, simply issue the command
backup archivelog all
. Optionally, you might want to back up a specific range of archived redo logs, for which you have several options available, including time, SCN, or redo log sequence number (or a selected range of those values). Specific options are
from SCN
,
from sequence
, and
from time
. Keep in mind that using the
from
option may

Chapter 11: RMAN Backups
251

result in some archived redo logs being left on disk and not being backed up. Here are some examples of backing up the archived redo logs:

backup archivelog all;

backup archivelog from time 'sysdate - 1';

backup archivelog from sequence 353;

NOTE

A new feature in Oracle Database 11
g
Release 2 is that if the archived
redo logs in the FRA are corrupted, Oracle will “fail over” to any other
defined archived redo log destination. If the archived redo log is in
that destination directory and it is not corrupted, RMAN will back up
the archived redo log from that source destination.

Once you have backed up archived redo logs, you may want to have RMAN remove them for you. The
delete input
option allows you to perform this operation. The
delete input
option can also be used with datafile copies (which we will discuss later in this chapter) or with backup set copies. Here are a couple of examples of using the
delete input
parameter on an archived redo log backup:

backup archivelog all delete input;

backup archivelog from sequence 353 delete input;

You can also instruct RMAN to make redundant copies of your archived redo logs. In the following example, we use the
not backed up
n
times
parameter of the
backup
command to make sure that we have backed up our archived redo logs at least three times. Any archived redo logs that have already been backed up three times will not be backed up again.

backup archivelog not backed up 3 times;

Also, you can use the
until time
parameter with the
backup
command to ensure that a certain number of days’ worth of archived redo logs remain on disk:

backup archivelog until time 'sysdate - 2' delete all input;

NOTE

Use of the
not backed up
parameter and use of the
delete input
parameter are somewhat mutually exclusive. The
delete input

parameter will remove the archived redo log regardless of how

many times it has been backed up.

Control File and Parameter File Backups

Just as with archived redo logs, sometimes you may just want to back up the control file or the server parameter files. RMAN provides specific commands for these functions as well. Use the
backup spfile
command to back up the server parameter file. This is handy if you have made a configuration change to the database, for example. To back up the control file, you can use the
current controlfile
parameter of the
backup
command to generate a copy of the current control file. The
current controlfile
parameter also comes with a
for standby
clause that will create a backup control file for use with a standby database.

Other books

Fool's Gold by Warren Murphy
A Date to Remember by Newton, LeTeisha
Too Hot to Handle by Matt Christopher
Bride of the Castle by John Dechancie
Sleepless Nights by Sarah Bilston
A Game of Spies by John Altman