martes, 22 de septiembre de 2009

RMAN Configuration Enviroment

-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Tue Sep 22 11:20:06 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: LETODB (DBID=3814852239)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup/letodb/%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET PARALLELISM 2;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 4 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbs/snapcf_letodb.f'; # default

RMAN>

Shows the archivelog deletion policy.

RMAN> show archivelog deletion policy;

RMAN configuration parameters are:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

Shows the number of archivelog backup copies.

RMAN> show archivelog backup copies;

RMAN configuration parameters are:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

Shows the auxiliary database information.

RMAN> show auxname;

RMAN configuration parameters are:
RMAN configuration has no stored or default parameters

Shows whether optimization is on or off.

RMAN> show backup optimization;

RMAN configuration parameters are:
CONFIGURE BACKUP OPTIMIZATION ON;

Shows how the normal channel and auxiliary
channel are configured.

RMAN> show channel;

RMAN configuration parameters are:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 4 G;


RMAN> show controlfile autobackup;

RMAN configuration parameters are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;

Shows the format of the autobackup control file.


RMAN> show controlfile autobackup format;

RMAN configuration parameters are:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup/letodb/%F';

Shows the number of datafile backup copies being
kept

RMAN> show datafile backup copies;

RMAN configuration parameters are:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

Shows the default type (disk or tape).


RMAN> show default device type;

RMAN configuration parameters are:
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default


Shows policy for datafile and control file backups
and copies that RMAN marks as obsolete.

RMAN> show retention policy;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS;


Shows the encryption algorithm currently in use.


RMAN> show encryption algorithm;

RMAN configuration parameters are:
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

RMAN> show encryption for database;

RMAN configuration parameters are:
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

RMAN> show encryption for tablespace;

RMAN configuration parameters are:
RMAN configuration has no stored or default parameters

Shows the tablespaces excluded from the backup.


RMAN> show exclude;

RMAN configuration parameters are:
RMAN configuration has no stored or default parameters

Shows the maximum size for backup sets. The
default is unlimited.

RMAN> show maxsetsize;

RMAN configuration parameters are:
CONFIGURE MAXSETSIZE TO UNLIMITED; # default


Shows the policy for datafile and control file
backups and copies that RMAN marks as obsolete.


RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS;


Shows the snapshot control filename.


RMAN> show snapshot controlfile name;

RMAN configuration parameters are:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbs/snapcf_letodb.f'; # default

Shows the compression algorithm in force. The
default is the ZLIB algorithm.

select * from v$rman_configuration;

CONF# NAME VALUE
---------- ------------------------------ ------------------------
1 RETENTION POLICY TO REDUNDANCY 3
2 BACKUP OPTIMIZATION ON
3 DEFAULT DEVICE TYPE TO sbt_tape
4 CONTROLFILE AUTOBACKUP ON
5 DEVICE TYPE DISK PARALLELISM 2
5 rows selected.

run
{
configure retention policy to 1 redundancy 2;
configure backup optimization off;
configure default device type to disk;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to
'/proj/11/backup/%F';
configure device type disk parallelism 2;
configure datafile backup copies for device type disk to 1;
configure archivelog backup copies for device type disk to 1;
configure maxsetsize to unlimited;
configure snapshot controlfile name to '/proj/11/backup/snapf_prod11.f';
}

Restoring Default Parameter Settings

RMAN> configure backup optimization clear;
RMAN> configure retention policy clear;
RMAN> configure channel device type sbt maxpiecesize 100m clear;
RMAN> configure channel device type sbt clear;

Enabling and Disabling Automatic Control File Backups

RMAN> configure controlfile autobackup on;

RMAN> configure controlfile autobackup clear;

Specifying the Autobackup Control File Directory
and Filename


RMAN> configure controlfile autobackup format
for device type disk to 'c:\rback\prod1\autobackup\controlfile_%F';

RMAN> configure controlfile autobackup format for device type disk clear;

You can also configure the autobackup to back up the control file to an automatic storage

management (ASM) disk group, as shown in the following example:

RMAN> configure controlfile autobackup
for device type disk to '+dgroup1/%F';

Specifying the Snapshot Control Filename and Location

RMAN> configure snapshot controlfile name to 'c:\rback\prod1\snct.ctl';

RMAN> configure snapshot controlfile name clear;

RMAN> show snapshot controlfile name;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbs/snapcf_letodb.f'; # default


Specifying the Retention Period for RMAN History

SQL> show parameter control_file_record_keep_time;

NAME TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
control_file_record_keep_time integer 7


SQL> alter system set control_file_record_keep_time=15;
System altered.


view provides information about the control file record sections.

select * from V$CONTROLFILE_RECORD_SECTION

Configuring the Default Device Type

RMAN> configure default device type to sbt;

You can use the clear option to return the default device type to disk again:

RMAN> configure default device type clear;

You can also explicitly reset the default device type to disk, as shown here:

RMAN> configure default device type to disk;

Once you configure the default device type to disk, all backups will be made to disk.

RMAN> backup device type sbt database;

RMAN> backup device type disk database;


RMAN> configure channel device type
sbt parms='sbt_library=/mediavendor/lib/libobk.so
env=(nsr_server=tape_svr,nsr_client=oracleclnt,
nsr_group=ora_tapes)';

RMAN> configure default device type to sbt;

RMAN> backup archivelog all;

RMAN> backup device type disk database;

Solution
The default backup type in RMAN, whether you’re backing up to disk or to tape, is a backup set.

You can change the default backup type to an image copy by using the following command:

RMAN> configure device type disk backup type to copy;
You can revert to the original setting of backup set backup type by using either of the following
two commands:

RMAN> configure device type disk clear;

RMAN> configure device type disk backup type to backupset;

Making Compressed Backup Sets the Default


RMAN> configure device type disk backup type to compressed backupset;
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
new RMAN configuration parameters are successfully stored
RMAN>


RMAN> show compression algorithm;
RMAN configuration parameters are:
CONFIGURE COMPRESSION ALGORITHM 'ZLIB'; # default


Configuring Multiple Backup Copies

RMAN> configure datafile backup copies for device type disk to 2;
RMAN> configure datafile backup copies for device type sbt to 2;

if you want to place one copy of a backup set in three different locations on disk, you
would configure RMAN as follows:


RMAN> show datafile backup copies;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

RMAN> show datafile backup copies;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

RMAN> show archivelog backup copies;

RMAN configuration parameters are:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

RMAN> configure channel device type disk format '/save1/%U','/save2/%U','save3/%U';


Skipping Previously Backed Up Files

RMAN> configure backup optimization on;

You can turn off backup optimization during a particular RMAN session and force RMAN
to back up a file regardless of whether it’s identical to a previously backed up file by specifying
the force option with your backup command, as shown here:

RMAN> backup database force;

RMAN> configure backup optimization off;

RMAN> backup database;
Starting backup at 09-NOV-06
using channel ORA_DISK_2
using channel ORA_DISK_1
using channel ORA_DISK_3
skipping datafile 1; already backed up 2 time(s)
skipping datafile 1; already backed up 2 time(s)
skipping datafile 1; already backed up 2 time(s)
skipping datafile 1; already backed up 2 time(s)


RMAN> backup device type sbt copies 3 archivelog all;

RMAN> configure backup optimization on;

RMAN> backup device type sbt copies 2 archivelog all;

Specifying Backup Piece Filenames

RMAN> backup tablespace users format = '/tmp/users_%u%p%c';


FORMATOS BACKUP

Type of File Meaning of %U
Datafile data-D-%d_id-%I_TS-%N_FNO-%f_%u
Archived log arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u
Control file cf-D_%d-id-%I_%u

Tagging RMAN Backups

RMAN> backup copies 1 datafile 5 tag test_bkp;

RMAN> backup as copy tag users_bkp tablespace users;

Configuring Automatic Channels

RMAN> configure default device type to sbt;

RMAN> configure device type sbt parallelism 3;

RMAN> backup device type sbt database plus archivelog;

RMAN> configure channel device type disk
maxpiecesize 1g;


RMAN> configure channel 1 device type disk format '/disk1/%U';

RMAN> configure channel 2 device type disk format '/disk2/%U';

RMAN> configure channel 3 device type disk format '/disk3/%U';

You use the clear option with the configure command to clear any automatic channel
settings. You must use a separate configure ... clear command to set the configuration back
to its default value. Here are some examples:

RMAN> configure default device type clear; # reverts to the default
device type (DISK)

RMAN> configure channel device type sbt clear; # erases all
options that were set for the sbt channel

RMAN> configure channel 1 device type disk clear; # erases
configuration values set specifically for channel 1.

RMAN> configure channel device type disk format '+dgroup1';

Manually Allocating RMAN Channels


run
{
allocate channel c1 device type sbt;
backup database plus archivelog
release channel c1;
}


Allocating an RMAN Maintenance Channel


RMAN> allocate channel for maintenance device type sbt;
RMAN> delete backup of database completed before 'sysdate-30';

Backup Retention Policy Based on a Recovery Window

RMAN> configure retention policy to recovery window of 7 days;

Configuring an Archived Redo Log Deletion Policy


RMAN> configure archivelog deletion policy to
2> backed up 2 times to sbt;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored

Limiting the Size of Individual Backup Pieces


RMAN> configure channel device type disk maxpiecesize = 1g;
RMAN> backup as backupset tablespace users;


RMAN> CONFIGURE CHANNEL DEVICE TYPE ‘SBT_TAPE’ clear;

RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' clear;

old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' MAXPIECESIZE 8 G;
old RMAN configuration parameters are successfully deleted