recovery manager overview target database recovery catalog database enterprise manager recovery...

35
Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session Server Session

Upload: geraldine-chase

Post on 27-Dec-2015

247 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Recovery Manager Overview

TargetDatabase

Recovery Catalog

Database

Enterprise Manager

Recovery Manager(RMAN)

Media

Options

Server Session

Server Session

Page 2: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Additional RMAN Features Operations

With RMAN, DBAs can:

• Use encryption to secure backup sets

• Utilize unused block compression to minimize backup size and time

• Configure dynamic channel allocation for (Real Application Cluster) RAC environments

• With the Enterprise Manager Grid Control, manage backup jobs across all databases

• Use specified incremental backup to roll forward standby database

Page 3: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Unused Block Compression

Oracle 10g, unlike previous Oracle releases, utilizes unused block compression. This means that it only backs up used blocks belonging to locally managed tablespaces.

Unused blocks are not backed up, saving considerably on time and space.

Page 4: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Real Application Clusters (RAC)

With Real Application Clusters (RAC), multiple low-cost computers can work together as a single large computer for database processing. When processing demands and the number of users increase, it is simple to add more RAC nodes.

You can use RMAN to backup an RAC configuration by configuring specific nodes or using a single node.

Page 5: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Incremental Backups and Physical Standby Databases

Incremental backups default to backing up blocks that were not backed up in previous backup operations

RMAN's "incremental backup from SCN" option allows one to start from specified SCN

Page 6: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Repository vs. Controlfile

RepositoryTrack Multitude of Databases

Maintain Backup / Recovery Scripts

ControlfileNo Repository needed

Page 7: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Encrypting Backup Sets

Use CONFIGURE ENCRYPTION command: CONFIGURE ENCRYPTION FOR [DATABASE | TABLESPACE …]

Users specify the encryption algorithm to use for the backup:

Oracle Wallet (default)User-specified password

Use RMAN and Oracle Secure Backup for encrypted backups to tape

Page 8: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Parameters that Affect RMAN

CONTROL_FILE_RECORD_KEEP_TIME

DB_RECOVERY_FILE_DEST

DB_RECOVERY_FILE_DEST_SIZE

NLS_DATE_FORMAT

NLS_LANG

Page 9: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Setting NLS_LANG and NLS_DATE_FORMAT

Environment variables set at the operating system level:

Windows:

REGEDIT

UNIXNLS_LANG=American_America.AR8MSWIN1256

export NLS_LANG

Page 10: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Initialization Parameters

CONTROL_FILE_RECORD_KEEP_TIME

DB_RECOVERY_FILE_DEST

DB_RECOVERY_FILE_DEST_SIZE

Page 11: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Change RMAN Default Settings with CONFIGURE

RMAN uses default settings for CONFIGURE options.

You can revert to the default for any CONFIGURE command by running the same command with the CLEAR option:RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

Page 12: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Uses for CONFIGURE

Change retention policy

Define the settings for automatic channels for a specified device type

Set the device type

Define the default format for the control file autobackup output files

Toggle control file autobackup feature

Page 13: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Using the SHOW Command

Display current value(s) for any or all of RMAN's configured settings

See which values are currently set to their defaults

Connect to the target database and recovery catalog (if used).

Execute SHOW command with appropriate setting:

RMAN> SHOW RETENTION POLICY;

Page 14: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Using the SHOW ALL CommandDisplays all settings that may be changed with CONFIGURE

The output is displayed as the series of RMAN commands that is necessary to re-create the configuration.

You can save the output of SHOW ALL into a text file and use that command file to re-create the configuration on the same or a different database.

Output lines containing a pound sign ( # ) indicate default values.

Page 15: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Setting a Retention Policy

A retention policy determines how long database backups are retained, as well as how far back you can recover your database. For many legal and other reasons, setting a retention policy is vital to a company. You can set retention policy in the form of either a recovery window (how far into the past you must be able to recover your database) or a redundancy value (how many backups of each file you need to retain).

Page 16: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Retention Policy Commands

Ensure that RMAN retains sufficient backups to be able to recover to any point in time in the past eight days:RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 8 DAYS;

Ensure that RMAN retains the last four backups of each data fileRMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 4;

Page 17: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

The DELETE OBSOLETE Command and the KEEP Option

DELETE OBSOLETE removes backups deemed obsolete by retention policy

Database automatically deletes obsolete backups in the flash recovery area when space is needed.

KEEP option of the BACKUP and CHANGE commands overrides the configured retention policy for individual backups

Page 18: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configuring RMAN to Write Disk Backups

RMAN channels are responsible for executing all RMAN tasks. By default, RMAN specifies one disk channel for all operations.

The following command configures RMAN to write disk backups to the /backup directory.CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/ora_df%t_s%s_s%p';

The format specifier %t is replaced with a four-byte time stamp, %s with the backup set number, and %p with the backup piece number.

Page 19: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configuring an Automatic Storage Disk Group

Specify ASM group as argument:CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '+dgroup1';

Implications:Backups directed away from flash recovery area

Loss of disk space management capabilities

Page 20: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Special Configuration for Media Managers

Use PARMS string in the CONFIGURE command:CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='ENV=mml_env_settings';

Use CONFIGURE DEVICE TYPE SBT to configure parallelism settings for SBT device

Page 21: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Automatically Back Up the Control and Server Parameter Files

Enable autobackup:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

Disable autobackup:

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

Page 22: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Change the Default Autobackup Format

You can change the default format by running the following command:CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO 'string';

• deviceSpecifier is any valid device • 'string' is a valid handle for the specified device• The only substitution variable permitted in

'string' is %F.

Page 23: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Clear the Default Autobackup Format

You can clear control file autobackup formats for a device by running the following commands:CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt CLEAR;

Page 24: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Specifying the SET CONTROLFILE AUTOBACKUP FORMAT Command

Order of precedence of controlfile autobackup formats:SET CONTROLFILE AUTOBACKUP FORMAT

(within a RUN block)

SET CONTROLFILE AUTOBACKUP FORMAT (at RMAN prompt)

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT

Page 25: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configure Backup Sets or Image Copies

Establish default file type for backup:RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY; # image copies

RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; # uncompressed backup sets

The default for backups to disk is backup set.

Page 26: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Write Control File Autobackups to the /backupdir Directory

Control file autobackups are stored in flash recovery area by default

Write control file autobackups to the /backupdir directory:RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backupdir/cf%F';

Page 27: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configure RMAN to Make Backups to Other Devices

RMAN backs up to disk by default

Set up SBT (tape / media manager) device, then direct RMAN to use it:CONFIGURE DEFAULT DEVICE TYPE TO sbt;

Page 28: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configuring RMAN to Use Compressed Backupsets

Instruct RMAN to use compressed backup sets by default:RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;

Use same command without COMPRESSED option to disable compression:RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET;

Page 29: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Manage RMAN’s Persistent Settings

Use CONFIGURE command to specify:Disk and SBT channel behavior

Backup destinations

Policies affecting backup strategy

Changes survive shutdown and restart of RMAN

Page 30: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

RMAN Disk Channel Behavior

One disk channel is "default" channel for all operations

Information stored in flash recovery area if no other location specified

Use FORMAT clause with CONFIGURE CHANNEL DEVICE TYPE DISK to specify alternative default location for disk backups

Page 31: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Configuring RMAN to Write Disk Backups to a Temporary Directory

Write disk backups to the directory /tmp:RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U';

Use CLEAR option to undo specific configuration:RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT CLEAR;

Page 32: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Make the Media Manager the Default Backup Destination

Configure media management software, then direct RMAN backups to media manager:

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;

Use PARMS string, if necessary, to pass parameters to media manager:

RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='ENV=mml_env_settings';

Use multiple channels for parallel backups

Page 33: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Start RMAN Utility and Allocate Channels

Start RMAN with a connection to the target database, the auxiliary instance, and, if applicable, the recovery catalog database:% rman TARGET SYS/oracle@trgt CATALOG rman/cat@catdb AUXILIARY SYS/oracle@aux

Page 34: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Manually Allocate Auxiliary Channels

Manually allocate at least one auxiliary channel if you have not configured automatic channelsThe channel type (DISK or sbt) must match the media. More channels means faster duplication if the backups are on disk.Limit the number of channels to the number of devices available for tape backups.

Page 35: Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session

Manually Allocate Auxiliary Channels – Example

Manual allocation of an SBT channel and three auxiliary channels:

RUN { ALLOCATE AUXILIARY CHANNEL ch1 DEVICE TYPE sbt; ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK; ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK; . . . DUPLICATE TARGET DATABASE TO dupdb;}