mercredi 9 novembre 2011

Oracle11g : RMAN persistant parameters

Persistant parameters for RMAN are defined through the CONFIGURE command.

To display all default parameters you can issue the following command:
$>rman target /
RMAN> SHOW ALL;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/11.2.0/dbs/snapcf_TEST.f'; # default
or you can connect to the database catalog instance as SYSDBA and take a look at the V$RMAN_CONFIGURATION.
$> export ORACLE_SID=RCAT_DB
$> sqlplus / as sydba
SQL> select * from V$RMAN_CONFIGURATION;

     CONF# NAME                 VALUE
---------- -------------------- ----------------------------------------------------------------------------------------------------
         1 RETENTION POLICY     TO RECOVERY WINDOW OF 1 DAYS
or you can connect to the database catalog instance as catalog owner and take a look at the RC_RMAN_CONFIGURATION.
$> export ORACLE_SID=RCAT_DB
$> sqlplus rcatowner/rcatowner
SQL> select * from RC_RMAN_CONFIGURATION;

     CONF# NAME                 VALUE
---------- -------------------- ----------------------------------------------------------------------------------------------------
         1 RETENTION POLICY     TO RECOVERY WINDOW OF 1 DAYS

remark:SHOW ALL is only available when you are connected to the target instance through RMAN. It does not work if you are connected only to the catalog (rman catalog <user>/<pwd>).

How to use the CONFIGURE command
With the CONFIGURE command, it is possible to :
  1. Configure the automatic bakup of the control file:
    RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
    RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;
    The controlfile autobackup is performed each time :
        - a successful backup is done
        - a script has been executed in RMAN
        - RMAN detects a database structure modification

  2. Alter the location and the file name format used by RMAN for the controlfile backup file:
    RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
    FOR DEVICE TYPE DISK TO '/u01/oradata/cf_ORCL_auto_%F';
  3. Configure an access to a device type in parallele:
    RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 3;
  4. Configure the default backup destination:
    RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    RMAN> CONFIGURE DEFAULT DEVICE TYPE TO TAPE;
  5. Configure a channel used by a backup operation:
    RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt...;
  6. Create severals copies of a same backup.
    In the following example, the datafile is backuped to a tape with 2 copies.
    RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE sbt TO 2;
    Same for archive logs
    RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE sbt TO 2;
    remark :This option is only available for backupset but not for image copies.

  7. Activate the RMAN optimization feature.
    This option allow RMAN to do not backup a file, if an identical file already exists in a previous backup.
    RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
    This option is set to OFF by default.

  8. Compress blocks using a compression algorithm (HIGH | MEDIUM | LOW | BASIC)
    RMAN> CONFIGURE COMPRESSION ALGORITHM 'LOW';
    or
    RMAN> RUN {
      SET COMPRESSION ALGORITHM 'LOW';
    }
    The section here under describes the compression algorithm used by each level :
        LOW       ==> LZO
        MEDIUM  ==> ZLIB
        HIGH      ==> GZIP
        BASIC     ==> BZIP2

note:Inside a RUN{} prefers the use of SET instead of CONFIGURE
RMAN> RUN {
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO ‘/opt/oracle/diag/rdbms/backup/rman/V1120/%F’;
}

How to show a parameter value
To display the default value, you can use the SHOW command.
For example :
RMAN> SHOW DEFAULT DEVICE TYPE;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

How to reset a parameter to its default value
To reset a persistant parameter you can use the keyword CLEAR in association to the CONFIGURE command.
For example to reset the default channel:
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;