• Aucun résultat trouvé

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT

Additional Topics

3. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT

You can configure the autobackup format even when CONFIGURE CONTROLFILE AUTOBACKUP is set to OFF, but RMAN does not generate autobackups in this case. For RMAN to make autobackups, you must set CONFIGURE CONTROLFILE AUTOBACKUP to ON.

OFF Disables the autobackup feature (default).

Any BACKUP command that includes datafile 1 automatically includes the current control file and server parameter file in the backup set. Otherwise, RMAN does not include these files.

CLEAR Returns this configuration to its default setting of OFF. Syntax Element Description

deviceConf

This subclause creates persistent configurations relating to channels and devices.

Names for Configured Channels

RMAN determines the names for configured channels. RMAN uses the following convention: ORA_devicetype_n, where devicetype refers to the user device type (such as DISK or sbt_tape) and n refers to the channel number. Channel names beginning with the ORA_ prefix are reserved by RMAN for its own use. You cannot manually allocate a channel with a name that begins with ORA_.

RMAN names the first DISK channel ORA_DISK_1, the second ORA_DISK_2, and so on. RMAN names the first sbt channel ORA_SBT_TAPE_1, the second ORA_SBT_

TAPE_2, and so on. When you parallelize channels, RMAN always allocates channels in numeric order, starting with 1 and ending with the parallelism setting (CONFIGURE DEVICE TYPE ... PARALLELISMn).

To run BACKUP or RESTORE jobs on specific configured channels, use the system-generated channel names. If you specify channel numbers in the

CONFIGURE CHANNEL command (see the deviceConf clause), then RMAN uses the same numbers in the system-generated channel names.

Automatic channel allocation also applies to maintenance commands. If RMAN allocates an automatic maintenance channel, then it uses the same naming convention as any other automatically allocated channel.

FORMAT FOR DEVICE TYPE deviceSpecifier TO formatSpec

Configures the default location and filename format for the control file autobackup on the specified device type (see Example 2–45 on page 2-83).

By default, the format is %F for all devices. Any default format string specified with CONFIGURE must include the %F substitution variable. Use of any other substitution variable is an error. Specify CLEAR to return the format to the default %F.

If a flash recovery area is enabled, and if the format is the default '%F', then RMAN creates the autobackup in the recovery area in a directory named autobackup. Otherwise, the default autobackup location is an operating system-specific location (?/dbs on UNIX, Linux, and Windows).

The string # default in the output of the SHOW command indicates when RMAN is using the default format. If you manually configure the disk format to '%F', then RMAN creates the autobackups in the operating system-specific default location even though the recovery area is enabled. To change the format back to its default so that RMAN creates the autobackups in the recovery area, run CONFIGURE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR. The formatSpec can specify an Automatic Storage Management disk group.

The following example configures a channel for an ASM disk group:

CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK TO '+dgroup1';

See Also: formatSpec on page 3-22 for the semantics of the %F substitution variable

Note: The sbt and sbt_tape device types are synonymous, but RMAN output always displays sbt_tape whether the input is sbt or sbt_tape.

Configured Channels in an Oracle RAC Environment

As long as the SYSDBA password for all Oracle RAC instances is the same, then you never need to put passwords in the CONNECT option of the ALLOCATE CHANNEL or CONFIGURE command. If you use a connect string of the form user@database, then RMAN automatically uses the same password that was used for the TARGET

connection when the RMAN session was started (see Example 2–43 on page 2-82).

Syntax Element Description [AUXILIARY] CHANNEL

[integer]

DEVICE TYPE deviceSpecifier

Specifies the standard or AUXILIARY channel that you are configuring or clearing, as well as the device type of the channel.

Note: Channels allocated with ALLOCATE CHANNEL within a RUN command override configured automatic channels.

Either configure a generic channel or specify a channel number, where integer is less than 255. See Example 2–43 on page 2-82 for an illustration of numbered channels.

If AUXILIARY is specified, then this configuration is used only for channels allocated at the auxiliary instance. Specify configuration information for auxiliary channels if they require different parameters from the channels allocated at the target instance. If no auxiliary device configuration is specified, then RMAN configures any auxiliary channels using the target database device configuration.

You must specify at least one channel option. For example, you cannot issue a command such as CONFIGURE CHANNEL 2 DEVICE TYPE DISK, but you can issue a command such as CONFIGURE CHANNEL 2 DEVICE TYPE DISK MAXPIECESIZE 2500K.

For generic channels of a specified device type, a new command erases previous settings for this device type. Assume that you run these commands:

CONFIGURE CHANNEL DEVICE TYPE sbt MAXPIECESIZE 1G;

CONFIGURE CHANNEL DEVICE TYPE sbt FORMAT 'bkup_%U';

The second command erases the MAXPIECESIZE setting of the first command.

Note: RMAN does not simultaneously allocate automatic channels for multiple device types in the BACKUP command.

See Also: Oracle Database Backup and Recovery User's Guide to learn how configure automatic channels specified by channel number

allocOperandList Specifies control options for the configured channel.

If you configure channels by using the nondefault CONNECT or PARMS options to create backups or copies, then you must either use the same configured channels or manually allocate channels with the same options to restore or crosscheck these backups.

Note that the FORMAT parameter can specify an Automatic Storage

Management disk group. The following example configures a channel for an ASM disk group:

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '+dgroup1';

See Also: allocOperandList on page 3-2

CLEAR Clears the specified channel. For example, CONFIGURE CHANNEL 1 DEVICE TYPE DISK CLEAR returns only channel 1 to its default, whereas CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR returns the generic disk channel to its default. Note that you cannot specify any other channel options (for example, PARMS) when you specify CLEAR.

DEFAULT DEVICE TYPE TO deviceSpecifier

Specifies the default device type for automatic channels. By default, DISK is the default device type. CLEAR returns the default device type to DISK.

By default, the BACKUP command only allocates channels of the default device type. For example, if you configure automatic channels for DISK and sbt and set the default device type to sbt, then RMAN only allocates tape channels when you run the BACKUP DATABASE command. You can override this behavior either by manually allocating channels in a RUN command, or by specifying DEVICE TYPE on the BACKUP command itself (see Example 2–41 on page 2-81).

The RESTORE command allocates automatic channels of all configured device types, regardless of the default device type. The RESTORE command obeys the PARALLELISM setting for each configured device type.

DEVICE TYPE deviceSpecifier

Specifies the device type (disk or sbt) to which to apply the settings specified in this CONFIGURE command. The CLEAR option resets backup type and

parallelism settings for this device to their defaults.

If you run the CONFIGURE DEVICE TYPE command to configure default settings for a device type and do not run CONFIGURE CHANNEL for this device type, then RMAN allocates all channels without other channel control options.

Assume that you configure the sbt device and run a backup as follows:

CONFIGURE DEVICE TYPE sbt PARALLELISM 1;

BACKUP DEVICE TYPE sbt DATABASE;

In effect, RMAN does the following when executing this backup:

RUN {

ALLOCATE CHANNEL ORA_SBT_TAPE_1 DEVICE TYPE sbt;

BACKUP DATABASE;

} BACKUP TYPE TO

[[COMPRESSED]

BACKUPSET | COPY]

Configures the default backup type for disk or tape backups. For SBT devices the COPY option is not supported. The default for disk is BACKUPSET.

If BACKUP TYPE is set to BACKUPSET, then the BACKUP command always produces backup sets regardless of which media the backup is created on. With the COMPRESSED option, the backup sets produced use binary compression.

The default location for disk backups is the flash recovery area, if one is configured; otherwise, RMAN stores backups in a platform-specific location.

The default format for backup filenames is %U.

PARALLELISMinteger Configures the number of automatic channels of the specified device type allocated for RMAN jobs. By default, PARALLELISM is set to 1.

Note: The CONFIGURE ... PARALLELISM parameter specifies channel parallelism, that is, the number of channels that RMAN allocates during backup and restore operations. The RECOVERY_PARALLELISM initialization parameter specifies the number of processes used in instance recovery.

Suppose you set PARALLELISM for disk backups to 2 (see Example 2–42 on page 2-81). If you set the default device type as disk, then RMAN allocates two disk channels when you run BACKUP DATABASE at the RMAN prompt. RMAN always allocates the number of channels set by PARALLELISM, although it may use only a subset of these channels.

Note: If you configure n manually numbered channels, then the PARALLELISM setting can be greater than or less than n. For example, you can manually number 10 automatic channels and configure PARALLELISM to 2 or 12.

To change the parallelism for a device type to n, run a new CONFIGURE DEVICE TYPE ... PARALLELISMn command. For example, you can change configure PARALLELISM to 3 for sbt and then change it to 2 as follows:

CONFIGURE DEVICE TYPE sbt PARALLELISM 3;

CONFIGURE DEVICE TYPE sbt PARALLELISM 2;

Examples

Example 2–40 Configuring Device and Backup Options

This example configures channels of device type DISK and sbt and sets the default device type as sbt. The example also enables backup optimization and configures a recovery windows of two weeks.

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/disk1/backups/%U';

CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(OB_DEVICE_1=tape1)';

CONFIGURE DEFAULT DEVICE TYPE TO sbt;

CONFIGURE BACKUP OPTIMIZATION ON;

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;

Example 2–41 Overriding the Default Device Type

This example configures duplexing to 2 for DISK backups of datafiles and control files (control file autobackups on disk are a special case and are never duplexed), then configures sbt as the default device.

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(OB_DEVICE_1=tape1)';

CONFIGURE DEFAULT DEVICE TYPE TO sbt;

The first BACKUP command backs up the archived redo logs on the default sbt channel. The second BACKUP command backs up the database to disk locations.

Because duplexing is enabled for disk backups, two copies of each output backup set are created.

BACKUP ARCHIVELOG ALL;

BACKUP DEVICE TYPE DISK DATABASE

FORMAT '/disk1/db_backup_%U','/disk2/db_backup_%U';

Example 2–42 Configuring Automatic Channels Across File Systems This example configures automatic disk channels across two file systems:

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/%U';

CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/%U';

Because PARALLELISM is set to 2, the following command divides the output data between two file systems:

BACKUP DEVICE TYPE DISK DATABASE PLUS ARCHIVELOG;

The following LIST command shows how the datafile backup was parallelized:

RMAN> LIST BACKUPSET 2031, 2032;

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time --- ---- -- --- --- --- ---2031 Full 401.99M DISK 00:00:57 19-JAN-07

BP Key: 2038 Status: AVAILABLE Compressed: NO Tag: TAG20070119T100532 Piece Name: /disk1/24i7ssnc_1_1

List of Datafiles in backup set 2031

1 Full 973497 19-JAN-07 /disk3/oracle/dbs/t_db1.f

List of Datafiles in backup set 2032 File LV Type Ckp SCN Ckp Time Name -- -- -

2 Full 973501 19-JAN-07 /disk3/oracle/dbs/t_ax1.f 3 Full 973501 19-JAN-07 /disk3/oracle/dbs/t_undo1.f 4 Full 973501 19-JAN-07 /disk3/oracle/dbs/tbs_111.f

Example 2–43 Configuring Automatic Channels in an Oracle Real Application Clusters (Oracle RAC) Configuration

This example assumes an Oracle RAC database with two nodes. Oracle Secure Backup is the media manager. Tape drive tape1 is directly attached to node1, while tape drive tape2 is directly attached to node2. The example configures an automatic SBT channel for each cluster node.

This example illustrates channel connections to Oracle RAC instances node1 and node2. For both channel connections, RMAN uses the same username and password that were entered for the target database connection.

CONFIGURE DEVICE TYPE sbt PARALLELISM 2;

CONFIGURE DEFAULT DEVICE TYPE TO sbt;

CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT '@node1' PARMS 'ENV=(OB_DEVICE=tape1)';

CONFIGURE CHANNEL 2 DEVICE TYPE sbt CONNECT '@node2' PARMS 'ENV=(OB_DEVICE=tape2)';

Example 2–44 Configuring Auxiliary Filenames

This example uses CONFIGURE AUXNAME to specify new filenames for the datafiles.

The DUPLICATE command duplicates a database to a remote host with a different directory structure.

# set auxiliary names for the datafiles

CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';

CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oracle/auxfiles/aux_2.f';

CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oracle/auxfiles/aux_3.f';

CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oracle/auxfiles/aux_4.f';

RUN {

ALLOCATE AUXILIARY CHANNEL dupdb1 TYPE DISK;

DUPLICATE TARGET DATABASE TO dupdb LOGFILE

# Un-specify the auxiliary names for the datafiles so that they are not

# overwritten by mistake:

CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;

CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR;

CONFIGURE AUXNAME FOR DATAFILE 3 CLEAR;

CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR;

Example 2–45 Specifying the Default Format for Control File Autobackup

The following example enables the autobackup feature and configures the default autobackup format for the DISK and sbt devices:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/disk2/%F';

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO 'cf_auto_%F';

Example 2–46 Creating Configurations for Standby Databases

Assume that primary database prod is associated with two standby databases with the DB_UNIQUE_NAME names dgprod3 and dgprod4. Assume that you start RMAN and connect to prod as TARGET and connect to a recovery catalog. The following commands configure the default device type for databases dgprod3 and dgprod4. CONFIGURE DEFAULT DEVICE TYPE TO sbt

FOR DB_UNIQUE_NAME dgprod3;

CONFIGURE DEVICE TYPE sbt PARALLELISM 2 FOR DB_UNIQUE_NAME dgprod3;

CONFIGURE DEFAULT DEVICE TYPE TO DISK FOR DB_UNIQUE_NAME dgprod4;

The control files of the two standby databases are updated with the configuration only after the reverse resynchronization from the recovery catalog to the control file, which occurs the first time that the user connects to dgprod3 and dgprod4.

The following SHOW command displays the persistent device type configurations for the database whose unique name is dgprod3:

RMAN> SHOW DEVICE TYPE FOR DB_UNIQUE_NAME dgprod3;

RMAN configuration parameters for database with db_unique_name DGPROD3 are:

CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default The following SHOW command displays the persistent configurations for all databases known to the recovery catalog whose DBID is 3257174182 (the value specified by the preceding SET DBID command):

SHOW ALL FOR DB_UNIQUE_NAME ALL;

Example 2–47 Optimizing Backups

This scenario illustrates the backup optimization behavior described in Table 2–3 on page 2-74. Assume that backup optimization is disabled. At 9 a.m., you back up three copies of all existing archived logs to tape. Note that the BACKUP_TAPE_IO_SLAVES initialization parameter must be true when duplexing backups to tape.

BACKUP DEVICE TYPE sbt COPIES 3 ARCHIVELOG ALL;

At 11 a.m., you enable backup optimization:

CONFIGURE BACKUP OPTIMIZATION ON;

At noon, you run the following archived redo log backup:

BACKUP DEVICE TYPE sbt COPIES 2 ARCHIVELOG ALL;

using channel ORA_SBT_TAPE_1

skipping archived log file /d1/db1r_605ab325_1_34_612112605.arc; already backed up 3 time(s) skipping archived log file /d1/db1r_605ab325_1_35_612112605.arc; already backed up 3 time(s) skipping archived log file /d1/db1r_605ab325_1_36_612112605.arc; already backed up 3 time(s) skipping archived log file /d1/db1r_605ab325_1_37_612112605.arc; already backed up 3 time(s) skipping archived log file /d1/db1r_605ab325_1_38_612112605.arc; already backed up 3 time(s) skipping archived log file /d1/db1r_605ab325_1_39_612112605.arc; already backed up 3 time(s) channel ORA_SBT_TAPE_1: starting archived log backup set

channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set input archived log thread=1 sequence=40 RECID=170 STAMP=612270506 channel ORA_SBT_TAPE_1: starting piece 1 at 19-JAN-07

channel ORA_SBT_TAPE_1: finished piece 1 at 19-JAN-07 with 2 copies and tag TAG20070119T110827

piece handle=2hi7t0db_1_1 comment=API Version 2.0,MMS Version 10.1.0.0 piece handle=2hi7t0db_1_2 comment=API Version 2.0,MMS Version 10.1.0.0

In this case, the BACKUP ... COPIES setting overrides the CONFIGURE ... COPIES setting, so RMAN sets n=2. RMAN skips the backup of a log only if at least two copies of the log exist on the sbt device. Because three copies of each log exist on sbt of all the logs generated on or before 9 a.m., RMAN skips the backups of these logs.

However, RMAN backs up two copies of all logs generated after 9 a.m. because these logs have not yet been backed up to tape.

CONNECT

Purpose

Use the CONNECT command to establish a connection between RMAN and a target, auxiliary, or recovery catalog database.

RMAN connections to a database are specified and authenticated in the same way as SQL*Plus connections to a database. The only difference is that RMAN connections to a target or auxiliary database require the SYSDBA privilege. The AS SYSDBA keywords are implied and cannot be explicitly specified. See Oracle Database Administrator's Guide to learn about database connection options when using SQL*Plus.

Prerequisites

You can only run the CONNECT TARGET, CONNECT CATALOG, and CONNECT AUXILIARY commands at the RMAN prompt and only if RMAN is not already connected to the databases specified by these commands. To connect to a different target, catalog, or auxiliary database you must start a new RMAN session.

Usage Notes

An RMAN session runs in NOCATALOG mode by default if all of the following conditions are met:

You did not specify CATALOG or NOCATALOG when you started RMAN.

You have not yet run CONNECT CATALOG in an RMAN session.

You run a command such as BACKUP that requires an RMAN repository connection (as shown in Example 2–49 on page 2-86).

Syntax

connect::=

(connectStringSpec::= on page 3-12)

Caution: Good security practice requires that passwords should not be entered in plain text on the command line. You should enter passwords in RMAN only when requested by an RMAN prompt. See Oracle Database Security Guide to learn about password protection.

See Also: RMAN on page 2-239 for command-line connection options

CONNECT AUXILIARY

CONNECT CATALOG connectStringSpec CONNECT TARGET

connectStringSpec

;

Examples

Example 2–48 Connecting to a Target Database Without a Recovery Catalog This example starts RMAN in NOCATALOG mode and then connects to the target database with an Oracle Net service name prod1. RMAN prompts for the SYS password.

% rman NOCATALOG

RMAN> CONNECT TARGET SYS@prod1;

target database Password: password

connected to target database: PROD1 (DBID=39525561)

Example 2–49 Connecting to a Target Database in the Default NOCATALOG Mode This example starts RMAN without specifying either CATALOG or NOCATALOG and then uses operating system authentication to connect to a target database with operating system authentication. Because no CONNECT CATALOG command has been run, RMAN defaults to NOCATALOG mode when you run the BACKUP command.

% rman

RMAN> CONNECT TARGET / RMAN> BACKUP DATABASE;

At this point in the RMAN session, you cannot run CONNECT CATALOG because the session has defaulted to NOCATALOG mode. An attempt to connect to the catalog in this session receives an error:

RMAN> CONNECT CATALOG rman@catdb Syntax Element Description

CONNECT AUXILIARY Establishes a connection between RMAN and an auxiliary database instance.

CONNECT AUXILIARY Establishes a connection between RMAN and an auxiliary database instance.