0% found this document useful (0 votes)
85 views

05-RMAN Backup and Configuration

This document discusses RMAN backup and configuration in Oracle databases. It covers various topics like RMAN vs user-managed backups, connection types in RMAN, RMAN commands, configuring persistent settings in RMAN including retention policies, control file autobackups, using media managers, and backup optimization. The objective is to explain concepts related to using RMAN for backups, configuration settings, retention policies, control file backups, and optimizing backups.

Uploaded by

Frances Patrick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

05-RMAN Backup and Configuration

This document discusses RMAN backup and configuration in Oracle databases. It covers various topics like RMAN vs user-managed backups, connection types in RMAN, RMAN commands, configuring persistent settings in RMAN including retention policies, control file autobackups, using media managers, and backup optimization. The objective is to explain concepts related to using RMAN for backups, configuration settings, retention policies, control file backups, and optimizing backups.

Uploaded by

Frances Patrick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

RMAN backup and configuration-CH5

RMAN backup and configuration

1
RMAN backup and configuration-CH5

Title Page Number

Backup Solutions 4

RMAN VS User-managed backups 5

Connection types with RMAN 5

Types of RMAN Commands 6

Configuring Persistent Settings for RMAN 7

Specifying a Retention Policy 9

Control File Autobackups 10

Using a Media Manager 11

Backup Optimization 14

2
RMAN backup and configuration-CH5

Key words:
RMAN, FRA, Sysbackup, RMAN backups, RMAN restore, RMAN
recovery, RMAN configuration, Retention Policy, Recovery
Window, Redundancy
Brief:
In this chapter we will introduce to Backup solutions, Rman
connections, Commands, Persistent Settings and Rman backup
features.

Objective:
In this chapter, we will explain some concepts related to RMAN
usage, persistent setting of RMAN and backup using RMAN this
includes:

▪ Backup Solutions
▪ RMAN VS User-managed backups.
▪ Connection types with RMAN.
▪ Types of RMAN Commands
▪ RMAN Persistent Settings.
▪ Specifying a Retention Policy
▪ Control File Autobackups
▪ Use RMAN to backup
▪ Using a Media Manager
▪ Backup Optimization

3
RMAN backup and configuration-CH5

1. Backup Solutions: Overview


Recovery Manager (RMAN): The recommended method of
backing up Oracle database. It used to back up to disk or to a
System Backup to Tape (SBT) channel. Oracle recommends
disk backups are stored in the Fast Recovery Area (FRA).
Using RMAN you can do the following:
▪ Back up the database, tablespaces, and data files, control
files, and archived redo logs.
▪ Manage backup and recovery tasks.
▪ Perform incremental block-level backup and block-level
media recovery
▪ Detect corrupted blocks during backup
▪ Use binary compression when creating backups
User-managed backups: using an OS utility. They are often
based on scripts that a DBA must write. This option is being
phased out because it is more labor intensive
Oracle Secure Backup: complements existing functionality by
adding backup to tape and backup of file system data. It
interacts transparently with RMAN.
See (Figure 1_5)

Figure 1_5

4
RMAN backup and configuration-CH5

2. RMAN VS User-managed backups


RMAN provides several features not available when you make
user-managed backups with operating system commands:
▪ Can store frequently executed operations as scripts in the
database.
▪ With block change tracking enabled in the database RMAN
can limit incremental backups to recording changed blocks
since the previous backup. This improves the performance of
backups and may also reduce the time it takes to perform
recovery operations in ARCHIVELOG mode.
▪ RMAN manage the size of backup pieces and save time by
parallelizing the backup operation.
▪ RMAN can recover an individual corrupt data block or set of
data blocks within a data file rather than restoring and
recovering the entire data file.
▪ RMAN operations can be integrated with the Oracle
Database Scheduler to automate backup operations.
▪ RMAN detect block corruption. The information relating to
the block corruption that is detected during backup can be
obtained by using the V$BACKUP_CORRUPTION and
V$COPY_CORRUPTION dynamic views.
▪ RMAN provides performance enhancements such as:
Automatic parallelization of backup, restore, and recovery
operations
3. Connection types with RMAN
Target database: connected to the target database with the
SYSBACKUP privilege. You must have this privilege for the
connection to succeed. The target database is the instance
where you want to perform typical RMAN operations.

Oracle_home\bin> rman target “ ‘ / as sysbackup ‘ “

Recovery catalog database: This is an optional database


which is configured for the RMAN repository. You connect to the
recovery catalog database when you want to retrieve information
stored within it, such as backup information or stored scripts.

Oracle_home\bin> rman TARGET SYS/sys_pwd@orcl


CATALOG rman/rman@rcat

5
RMAN backup and configuration-CH5

Auxiliary database: An auxiliary database can be a database


that is created using the RMAN DUPLICATE command or

Temporary database that is used during tablespace point-in-time


recovery (TSPITR) .

Oracle_home\bin> rman TARGET SYS/sys_pwd@orcl


AUXILIARY sys/aux_pwd@aux1

Note: Avoid the use of the SYSDBA privilege unless it is


necessary.
From the RMAN command line
• Execute SQL commands and PL/SQL procedures.
• Use the optional SQL prefix to avoid ambiguity.
• Use the DESCRIBE command to list the columns of a
table of view.
RMAN> SELECT NAME, DBID, LOG_MODE FROM
V$DATABASE;

4. Types of RMAN Commands


RMAN commands are of the following types:
4.1. Stand-alone command
Stand-alone commands are executed at the RMAN prompt and
are generally self-contained
• Is executed individually at the RMAN prompt
• Cannot appear as subcommands within RUN
4.2. Job command
Usually grouped and executed sequentially inside a command
block. If any command within the block fails, RMAN ceases
processing; no further commands within the block are executed.
The effects of any already executed commands still remain,
though; they are not undone in any way.
• Must be within the braces of a RUN command
• Is executed as a group
• Some commands can be executed as both types.

6
RMAN backup and configuration-CH5

Job Commands: Example


RMAN> RUN
2> {
3> ALLOCATE CHANNEL c1 DEVICE TYPE DISK
4> FORMAT "/disk2/%U";
5> BACKUP AS BACKUPSET DATABASE;
6> SQL 'alter system archive log current';
7> }

5. Configuring Persistent Settings for RMAN


Use the CONFIGURE command to:
▪ Configure automatic channels
▪ Specify the backup retention policy
▪ Specify the number of backup copies to be created
▪ Set the default backup type to BACKUPSET or COPY
▪ Limit the size of backup pieces
▪ Exempt a tablespace from backup
▪ Enable and disable backup optimization
▪ Configure automatic backups of control files
▪ Define the archive log deletion policy
▪ Specify the parallelism for a device
▪ Set the encryption and compression parameters to be used
▪ for backups

5.1. Viewing Persistent Settings

To examine the persistent RMAN settings for a database:


Use the RMAN SHOW ALL command to view all
Configuration settings
Query the V$RMAN_CONFIGURATION view to display
Configuration settings that have been explicitly set
See (Figure 2_5)

7
RMAN backup and configuration-CH5

Figure 2_5
6. Managing Persistent Settings:
Use multiple streams of data to and from a device:
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 3;

Use the SHOW command to list current settings:


RMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;
RMAN> SHOW EXCLUDE;
RMAN> SHOW ALL;

Use the CLEAR option of the CONFIGURE command to


Reset any persistent setting to its default value:
RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;
RMAN> CONFIGURE MAXSETSIZE CLEAR;
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 3;

8
RMAN backup and configuration-CH5

6.1. Specifying a Retention Policy


A retention policy describes which backups will be kept and for
how long. You can set the value of the retention policy by using
the RMAN CONFIGURE command.
6.2. Recovery Window Retention Policy
The best practice is to establish a period of time during which it
will be possible to discover logical errors and fix the affected
objects by doing a point-in-time recovery to just before the error
occurred. This period of time is called the recovery window.
This policy is specified in number of days. For each data file,
there must always exist at least one backup that satisfies the
following condition: SYSDATE – backup_checkpoint_time >=
recovery_window You can use the following command syntax to
configure a recovery window retention policy: RMAN>
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW
OF <days> DAYS; where <days> is the size of the recovery
window see (Figure 3_5).

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY


WINDOW OF 7 DAYS ;

Window time period should be less than or equal to the value of


the CONTROL_FILE_RECORD_KEEP_TIME parameter which
specifies the minimum number of days before a RMAN Meta
Data recorded in the control file can be reused, and prevent the
record of older backups from being overwritten in the control file

Figure 3_5

6.2.1. Redundancy Retention Policy


This option requires that a specified number of backups be
cataloged before any backup is identified as obsolete. The
default retention policy has a redundancy of 1, which means
that only one backup of a file must exist at any given time.
A backup is deemed obsolete when a more recent version of
the same file has been backed up. You can use the following

9
RMAN backup and configuration-CH5

command to reconfigure a redundancy retention policy: RMAN>


CONFIGURE RETENTION POLICY TO REDUNDANCY
<copies>; where <copies> is the number of copies that are
required for policy satisfaction see (Figure 4_5).

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2 ;

Figure 4_5
6.3. Control File Autobackups.
To easily recover from the loss of all control file copies, you
should configure RMAN to take automatic backups of the
control file. The automatic backup of the control file occurs
independently of any backup of the current control file explicitly
requested as part of your backup command. If you are running
RMAN in NOCATALOG mode, it is highly recommended that
you activate control file autobackup. Otherwise, if you lose your
control file, your database may be unrecoverable.
To configure control file autobackup, modify the backup policy
for your database by using the following RMAN command:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
By default, control file autobackups are disabled. If you enable
control file autobackups, then RMAN automatically backs up
the control file and the current server parameter file (if used to
start up the database) under the following circumstances:
• At the end of a run script
• When a successful backup is recorded in the RMAN
repository
• When a structural change of the database occurs the
Oracle kernel itself makes the backup (for example, after
DDL operations that affect the content of the control file)
The control file autobackup file name has a default format of
%F for all device types, so that RMAN can infer the file location
and restore it without a repository. This variable format
translates into c-IIIIIIIIII-YYYYMMDD-QQ, where:

10
RMAN backup and configuration-CH5

• IIIIIIIIII stands for the DBID


• YYYYMMDD is a time stamp of the day the backup is
generated
• QQ is the hex sequence that starts with 00 and has a
maximum of FF
You can change the default format by using the CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE
type TO 'string' command. The value of string must contain the
substitution variable %F and cannot contain other substitution
variables. For example:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
FOR DEVICE TYPE DISK TO '/u01/oradata/cf_ORCL_auto_%F';

Control file autobackups are stored in the Flash Recovery Area,


unless otherwise specified.
With a control file autobackup, RMAN can recover the database
even if the current control file, recovery catalog, and server
parameter file are inaccessible. Because the path used to store
the autobackup follows a well-known format, RMAN can search
for and restore the server parameter file or control file from that
autobackup.
6.4. Using a Media Manager
To use tape storage for your database backups, RMAN
requires Oracle Secure Backup or a media manager see
(Figure 5_5). A media manager is a utility that loads, labels,
and unloads sequential media (such as tape drives) for the
purpose of backing up, restoring, and recovering data. The
Oracle database server calls Media Management Library
(MML) software routines to back up and restore data files to
and from media that is controlled by the media manager. Note
that the Oracle database server does not need to connect to
the MML software when it backs up to disk. Oracle Backup
Solutions Program (BSP) provides a range of media
management products that are compliant with Oracle’s MML
specification. Software that is compliant with the MML interface
enables an Oracle database session to back up data to a media
manager and request the media manager to restore backups.
Check with your media vendor to determine whether it is a
member of Oracle BSP. Before you can begin using RMAN with
a media manager, you must install the media manager software
and make sure that RMAN can communicate with it.
11
RMAN backup and configuration-CH5

Instructions for this procedure should be available in the media


manager vendor’s software documentation.
Depending on the product that you are installing, perform the
following basic steps:
Install and configure the media management software on the
target host or production network

run { and install the third-party media management module


Obtain
for integration with the Oracle database.
CHANNEL ch1 DEVICE TYPE sbt;
BACKUP DATAFILE 3;
}

Figure 5_5
6.5. Specifying a Backup Destination
Backups can be written to a designated disk directory, a media
management library (MML), or the Fast Recovery Area.
Specifying a disk directory or the Fast Recovery Area means
that backups go to hard-disk media. Typically, backups are
regularly moved offline to tape via the media management
interface in order to maintain disk space availability. Any disk
directory can be specified as the destination of a backup
provided that it already exists. A media management library can
be used to copy files to tape devices, or to carry out proxy
copies. A proxy copy is where the MML is requested to make a
copy of a file to a disk or tape device. The MML must be able to
provide the proxy copy service for this to work. If you set up a

12
RMAN backup and configuration-CH5

Fast Recovery Area, many backup and recovery tasks are


simplified for you. The Oracle database automatically names
files for you, and deletes obsolete files when there is space
pressure. To specify that backups are to be written to disk, use
the first command in the slide. Subsequently, when backups
are made, if the FORMAT keyword is used (that specifies a disk
directory location for the backup), then the backup is written
there. If there is a Fast Recovery Area configured, then it goes
there; otherwise, backups are written to a platform-specific
default location.
Disk directory:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;

Tape:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO TAPE;

6.6. Configuring and Allocating Channels


Choose from the following options for configuring channels and
executing backups:
• Configure automatic channels with the CONFIGURE
command, and then issue the BACKUP command at the RMAN
prompt or within a RUN block.
RMAN> CONFIGURE DEVICE TYPE sbt;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt ;
RMAN> BACKUP DATABASE;

• Manually allocate channels with the ALLOCATE CHANNEL


command, and then issue BACKUP commands
RMAN> RUN
{
ALLOCATE CHANNEL ch1 DEVICE TYPE DISK;
BACKUP DATABASE PLUS ARCHIVELOG;
}

13
RMAN backup and configuration-CH5

6.7. Creating Duplexed Backup Sets


RMAN can make up to four copies of a backup set
simultaneously, each an exact duplicate of the others. A copy of
a backup set is a copy of each backup piece in the backup set,
with each copy getting a unique copy number. In most cases,
the easiest method of duplexing backup sets is to use
BACKUP...COPIES or CONFIGURE ... BACKUP COPIES to
duplex backup sets. For DISK channels, specify multiple values
in the FORMAT option to direct the multiple copies to different
physical disks. Note that it is not possible to duplex backup sets
to the Fast Recovery Area, and that duplexing applies only to
backup sets, not image copies. You receive an error if you
specify the BACKUP... COPIES option when creating image
copy backups. The CONFIGURE...BACKUP COPIES setting is
ignored for image copy backups. Duplexed backup sets are
typically used for tape backups

RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES


2> FOR DEVICE TYPE sbt TO 2;
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;

6.8. Backup Optimization


If you enable backup optimization, the BACKUP command
skips files when the identical files have already been backed up
to the specified device type. If RMAN determines that a file is
identical and it has already been backed up, it is a candidate to
be skipped.

RMAN> CONFIGURE BACKUP OPTIMIZATION ON ;

6.9. Compressing Backups


Binary compression can be used to algorithmically compact the
data that is written. The available compression algorithms are
HIGH, MEDIUM, LOW, and BASIC. If you specify it for a
specific backup device, then use the COMPRESSED keyword
after the BACKUP TYPE TO clause. You do not have to
perform any additional steps when restoring a compressed
backup. Both creating and restoring a compressed backup will,
of course, probably take longer and require more system
Resources. When choosing an algorithm, consider your disk

14
RMAN backup and configuration-CH5

space in addition to dynamic system resources such as CPU


and memory.

RMAN> CONFIGURE COMPRESSION ALGORITHM


'HIGH/MEDIUM/LOW/BASIC'

run {
SET COMPRESSION ALGORITHM
'HIGH/MEDIUM/LOW/BASIC';
..
}

15

You might also like