Oracle RMAN 11g Backup and Recovery (46 page)

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

Be careful when using
maxsetsize
to limit the size of the entire backup
that is being created. While your database might be smaller than

the
maxsetsize
defined initially, it could quickly grow beyond the
maxsetsize
, causing your database backups to fail.

88
Part II: Setup Principles and Practices

As you will see in later chapters, you can configure the backup process to create duplexed backups; in other words, multiple copies of the backup can be created at different locations. You can also configure database default settings such that automatic backups will be duplexed using the
configure
command. Here is an example where we have defined that all backups to disk by default will be duplexed, with two copies:

configure datafile backup copies for device type disk to 2;

You may wish to exclude specific tablespaces during an automated backup, which Oracle allows you to do with the
configure
command. Here is an example of excluding a tablespace by default:

configure exclude for tablespace old data;

The
configure
command allows you to enable or disable backup optimization. When enabled,
backup optimization
will cause Oracle to skip backups of files that already have identical backups on the device being backed up to. Here is an example of configuring backup optimization:

configure backup optimization on;

Note that for optimization to occur, you must have enabled it. In addition, you must issue the
backup database
or
backup archivelog
command with the
like
or
all
option. Alternatively, you can use the
backup backupset all
command (more information on these types of backups is provided in later chapters). Finally, you can disable the setting for backup optimization by using the
force
parameter of the
backup
command.

Configuring Snapshot Control File Settings

We discussed the snapshot control file in Chapter 2. This file is a point-in-time copy of the database control file that is taken during RMAN backup operations. The snapshot control file ensures that the backup is consistent to a given point in time. Thus, if you add a tablespace or datafile to a database after the backup has started (assuming an online backup, of course), that tablespace or datafile will not be included in the backup. Sometimes it is desirable to have RMAN

create the backup control file in a location other than the default location. In this event, you can use the
configure
command to define a new default location for the snapshot control file: configure snapshot controlfile name to 'd:\oracle\backup\scontrolf mydb'; Note that Oracle does not create the snapshot control file in the FRA even if the FRA is configured. Also note in this example, we include the name of the database (or database instance if running RAC) to ensure the snapshot control filenames are unique.

Using the Format String

Note in previous examples that in several places we defined one or more disk locations and filename formats. This is known as the
format string specification.
You will see the format string specification used a great deal in this book, and you will often use it when working with RMAN

unless you are using the FRA. The FRA uses Oracle’s own file-naming conventions, so using a format string when backing up to the FRA is not recommended or required (and can cause problems with file maintenance). Since the FRA is the default location for backups, there is no need to configure a backup device to point to the FRA. You may need to configure channels for other reasons, but do not configure them such that they have a format string pointing to the FRA.

Chapter 3: RMAN Setup and Configuration
89

The format string is platform independent (though directory structures will be platform specific). A format string on Windows will look pretty much the same on Unix or on any other platform. For example, if we were using a Unix system, our format string might look like this: CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT

'/u01/opt/oracle/backup/robt/backup %U';

CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT

'/u01/opt/oracle/backup/robt/backup %U';

NOTE

Oracle will not manage your backup files if you use the
format
parameter, even if you are backing up to the FRA, because the backup
is not managed by Oracle. If the
format
parameter is used, then the
retention policy will have to remove the formatted backups. If
format
is not used, then OMF names are used, and the files are created in the
FRA. Do not use the
format
option when backing up to the FRA.

The format string is used a lot in the
configure
command. You will also see it in other RMAN

commands such as the
backup
,
restore
, and
allocate channel
commands. RMAN offers several
syntax elements
associated with the format string specification. These elements are placeholders that will cause RMAN to replace the format string with the associated defined values. For example, the %U syntax element in the previous example tells RMAN to substitute a system-generated unique identifier for the filename. %U then keeps each backup filename unique.

Table 3-3 lists the valid syntax elements and gives a quick description of their use.

Element

Description

%a

Indicates that the activation ID of the database should be substituted.

%b

Specifies the filename without any directory paths. This can only be used with the
set newname
command or for creating a backup using image copies.

%c

Specifies that the copy number of the backup piece within a set of duplexed backup pieces, with a maximum value of 256, should be substituted. This number will be 1 for nonduplexed backup sets and 0 for proxy copies.

%d

Indicates that the name of the database should be substituted.

%D

Indicates that the current day of the month from the Gregorian calendar in the format DD should be substituted.

%e

Indicates that the archived log sequence number should be substituted.

%f

Indicates that the absolute file number should be substituted.

%F

Provides a unique and repeatable name that combines the database ID (DBID), day, month, year, and sequence.

%h

Indicates that the archived redo log thread number should be substituted.

%I

Indicates that the DBID should be substituted.

TABLE 3-3
Format String Specification Descriptions

90
Part II: Setup Principles and Practices

Element

Description

%M

Indicates that the month in the Gregorian calendar in the format MM should be substituted.

%N

Indicates that the tablespace name should be substituted.

%n

Indicates that the name of the database, padded on the right with x characters to a total length of eight characters, should be substituted. For example, if ROBDB is the database name, then the padded name is ROBDBxxx.

%p

Indicates that the piece number within the backup set should be substituted. This value starts at 1 for each backup set and is incremented by 1 as each backup piece is created.

%s

Indicates that the backup set number should be substituted. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1. This number will be unique for the lifetime of the control file (thus, it is reset at RESETLOGS or when the control file is restored or re-created).

%t

Indicates that the backup set timestamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time, should be substituted.

%s and %t combined can be used to form a unique name for the backup set.

%T

Indicates that the year, month, and day from the Gregorian calendar in the format YYYYMMDD should be substituted.

Other books

Where You Belong by Barbara Taylor Bradford
Hermosas criaturas by Kami Garcia & Margaret Stohl
The Day of Atonement by David Liss
Waking Up in Charleston by Sherryl Woods
What's Left Behind by Lorrie Thomson
Zorro by Isabel Allende