Wednesday, 29 January 2020

RMAN Basic Commands

Oracle Recovery Manager (RMAN) satisfies the most pressing demands of performant, manageable backup and recovery, for all Oracle data formats.

RMAN  provides a common interface, via command line and Enterprise Manager, for backup tasks across different host operating systems.

Below are some of the commonly used RMAN commands which you can run through RMAN command line.


All the commands were tested on Oracle database version 11gR2 (11.2.0.4)

**SHOW COMMAND**

1) Shows all parameters.

RMAN> show all;

2) Shows the archivelog deletion policy.

RMAN> show archivelog deletion policy;

3) Shows the number of archivelog backup copies

RMAN> show archivelog backup copies;

4) Shows the auxiliary database information.

RMAN> show auxname;

5) Shows whether optimization is on or off.

RMAN> show backup optimization;

 6) Shows how the normal channel and auxiliary channel are configured.

RMAN> show [auxiliary] channel;

 7) Shows the characteristics of the channel

RMAN> show channel for device type [disk | <media device>;

8) Shows whether control file autobackup is on or off.

RMAN> show controlfile autobackup;

9) Shows the format of the autobackup control file

RMAN> show controlfile autobackup format;

10) Shows the number of datafile backup copies being kept.

RMAN> show datafile backup copies;

11) Shows the default type (disk or tape)

RMAN> show default device type;

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

RMAN> show retention policy;

13) Shows the encryption algorithm currently in use.

RMAN> show encryption algorithm;

14) Shows the encryption for the database and every tablespace.

RMAN> show encryption for [database | tablespace];

15) Shows the tablespaces excluded from the backup.

RMAN> show exclude;

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

RMAN> show maxsetsize;

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

RMAN> show retention policy;

18) Shows the snapshot control filename.

RMAN> show snapshot controlfile name;

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

RMAN> show compression algorithm;

**BACKUP COMMAND**



1) To perform a manual backup of the current control file

RMAN> backup current controlfile;

2) To back up the control file as part of a tablespace backup operation

RMAN> backup tablespace users include current controlfile;

3) To back up the server parameter file

RMAN> backup spfile;

4) To restart an RMAN backup that failed midway through a nightly backup.

RMAN> backup not backed up since time ‘sysdate-1′ database plus archivelog;

5) To force RMAN to back up a file regardless of whether it’s identical to a previously backed up file by specifying the force option

RMAN> backup database force;

By using the force option, you make RMAN back up all the specified files, even if the backup optimization feature is turned on.

6) To backup complete database

RMAN> backup database;

7) To backup database plus archivelogs

RMAN> backup database plus archivelogs;

8) To backup all archive logs

RMAN> backup archivelog all;

9) To backup specific data file

RMAN> backup datafile 5 tag dbfile_5_bkp;

A tag was also added to easily locate this datafile’s backup.

**CATALOG COMMAND**

1) Add user-managed copies of datafile to RMAN repository

RMAN> catalog datafilecopy ‘/u01/oracle/users.bkp’;

RMAN> catalog datafilecopy ‘/u01/oracle/users.bkp’ level 0;  (To catalog as incremental level 0 backup)

2) Add uncataloged backup piece to RMAN repository

RMAN> catalog backuppiece ‘ertt2lu4_1_1′;

3) To catalog multiple files ( say you copied production backup to target database for database cloning)

RMAN> catalog start with ‘/backups/source_bkp’ noprompt;

The start with clause specifies that RMAN catalog all valid backup sets, datafile copies, and archived redo logs starting with the string pattern you pass.

4) To catalog all files in the flash recovery area

RMAN> catalog recovery area;



**REPORT COMMAND**

1) To find out which backups you need to make in order to conform to the retention policy you put in place

RMAN> report need backup;

The output of the report need backup command tells you that you must back up which all database files to comply with your retention policy.

2) To get a report about all the datafiles in a database

RMAN> report schema;

RMAN> report schema at time ‘sysdate-1′;  (from a past point in time)

3) To reports on any obsolete backups

RMAN> crosscheck backup;

RMAN> report obsolete;

Always run the crosscheck command first in order to update the status of the backups in the RMAN repository to that on disk and tape.





**LIST COMMAND**

1) To review RMAN backups of datafiles, archived redo logs, and control files.

RMAN> list backup;

2) List the backups by just the backup files

RMAN> list backup by file;

3) Lists only backup sets and proxy copies but not image copies

RMAN> list backupset;

4) Lists only datafile, archived redo log, and control file copies

RMAN> list copy;

5) Lists backups by tag:

RMAN> list backupset tag ‘full_database_backup’;

6) To list the backups of all datafiles and archivelogs of the target database:

RMAN> list backup of database;

7) Lists all incarnations of a database

RMAN> list incarnation;

When you perform an open resetlogs operation, it results in the creation of a new incarnation of the database. When performing recovery operations on such a database, you might want to check the database incarnation

8) Lists all restore points in the target database

RMAN> list restore point;

9) Lists the names of all recovery catalog scripts

RMAN> list script names;

10) Which of the backups of the target database have an expired status in the repository.

RMAN> list expired backup;

11) Which of the archived redo log backups have the expired status

RMAN> list expired archivelog all;

12) To restrict the list of backups  and copies whose status is listed as available

RMAN> list recoverable backup;

13) To view all the restore points in the database

RMAN> list restore point all;



**CROSSCHECK COMMAND**

1) Cross-checking just backup sets

RMAN> crosscheck backupset;

2) Cross-checking a copy of a database

RMAN> crosscheck copy of database;

3) Cross-checking specific backupsets

RMAN> crosscheck backupset 10, 12;

4) Cross-checking using a backup tag

RMAN> crosscheck backuppiece tag = ‘monthly_backup’;

5) Cross-checking a control file copy;

RMAN> crosscheck controlfilecopy ‘/backups/control01.ctl’;

6) Cross-checking backups completed after a specific time

RMAN> crosscheck backup of datafile “/u01/oracle//system01.dbf” completed after ‘sysdate-7′;

7)  Cross-checking of all archivelogs and the spfile

RMAN> crosscheck backup of archivelog all spfile;

8) Cross-checking all backups on disk and tape

RMAN> crosscheck backup;

The crosscheck command checks whether the backups still exist. The command checks backup sets, proxy copies, and image copies.



**DELETE COMMAND**

1) To remove both archived redo logs and RMAN backups

RMAN> delete backup;

RMAN always prompts you for confirmation before going ahead and deleting the backup files. You can issue the delete noprompt command to suppress the confirmation prompt. This will also remove the physical file from the backup media

To make sure the repository and the physical media are synchronized, run “RMAN> crosscheck backup;” before running above command

2) To remove all image copies

RMAN> delete copy;

To make sure the repository and the physical media are synchronized, run “RMAN> crosscheck copy;” before running above command

3) To delete specfic backuppiece

RMAN> delete backuppiece 9;

4) To delete copy of controlfile under /backups

RMAN> delete copy of controlfile like ‘/backups/%’;

5) To delete backups with specific tag

RMAN> delete backup tag=’double_bkp_prod’;

6) To delete bakups of specific tablespace

RMAN> delete backup of tablespace sysaux device type sbt;

******************

You can also use force, expired, obsolete keyword with delete commad:



delete force ..: Deletes the specified files whether they actually exist on media or not and removes their records from the RMAN repository as well



delete expired ..: Deletes only those files marked as expired  as per crosscheck command.



delete obsolete ..: Deletes datafile backups and copies and the archived redo logs and log backups that are recorded as obsolete in the RMAN repository

The delete obsolete command relies only on the backup retention policy in force.

******************

7) To delete all archived redo logs

RMAN> delete archivelog all;

8) To delete already backed up archived redo logs

RMAN> delete archivelog all backed up 2 times to sbt;

9) To delete specific archived redo logs

RMAN> delete archivelog until sequence = 1234;

10) Delete archive logs after taking backup

RMAN> backup device type sbt archivelog all delete all input;

11) Delete stored script

RMAN> delete script full_disk_db;

If you have two scripts—one local and one global—in the same name, then the delete script command drops the local one, not the global one. If you want to drop the global script, you must use the keyword global in the command, as shown here:

RMAN> delete global script full_disk_db;



**CHANGE COMMAND**

1) Change the status of a backup set to unavailable

RMAN> change backupset 6 unavailable;

You usually do it when you don’t want to delete the backup/copy but you also don’t want to delete that backup/copy (probably it is not available physically on disk)

Once you mark a backup file unavailable, RMAN won’t use that file in a restore or recover operation.

2)  Change the status of a backup set to available again

RMAN> change backupset 6 available;

For example, say you performed a backup using an NFS-mounted disk and that disk subsequently becomes inaccessible for some reasons, just  issue the change command to set the status of the backup as unavailable. Later, once the disk becomes accessible again, you can change its status back to available.

3) To modify a regular consistent database backup into an archival backup:

RMAN> change backup tag ‘initial_db_bkup’ keep forever;

When you make an archival backup with the keep … forever option, RMAN disregards the backup retention time for these backups.

4) To change the archival backup to a normal database backup

RMAN> change backup tag ‘inital_db_backup’ nokeep;

When you run the change … nokeep command, the backup set with the tag inital_db_backup, which was previously designated as a long term archival backup, will once again come under the purview of your configured retention policy.

5) To modify the time period for which you want to retain the archival backups

RMAN> change backupset 12 keep until time ‘sysdate+60′;

After the 60 days are up, the backup will become obsolete and is eligible for deletion by the delete obsolete command.



**VALIDATE COMMAND**

1) To check all the datafiles and the archived redo logs for physical corruption  without actually performing the backup

RMAN> backup validate database archivelog all;

2) To check for logical corruption  without actually performing the backup

RMAN> backup validate check logical database archivelog all;

The check logical clause means that RMAN will check for logical corruption only.

3) To validate a single backup set

RMAN> validate backupset 5;

4) To validate all datafiles at once

RMAN> validate database;

Note that the validate command can check at a much more granular level than the backup … validate command. You can use the validate command with individual datafiles, backup sets, and even data blocks.

The validate command always skips all the data blocks that were never used, in each of the datafile it validates.

5)  To validate recovery area

RMAN> validate recovery area;

6) To validate all the recovery related files

 RMAN> validate recovery files;

7) To validate the spfile

RMAN> validate spfile;

8) To validate specific tablespace

 RMAN> validate tablespace <tablespace_name>;

9) To validate specific control file copy

 RMAN> validate controlfilecopy <filename>;

10) To validate specific backupset

RMAN> validate backupset <primary_key>;

Tuesday, 28 January 2020

RMAN Show All Commands Description

RMAN Show Command
The SHOW command returns the values of various parameters.

SHOW ALL
The SHOW ALL command shows the value of all configuration parameters.

The default values are as follows:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
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 ENCRYPTION FOR DATABASE OFF;
CONFIGURE ENCRYPTION ALGORITHM 'AES128';
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST.f'; # default

The default value for SNAPSHOT CONTROLFILE NAME is $ORACLE_HOME/snapcf_.f

Following statement can be used to see non-default configurations

SELECT NAME, VALUE FROM V$RMAN_CONFIGURATION ;


1) CONFIGURE RETENTION POLICY TO REDUNDANCY 1; (default)


RMAN considers backups and copies of datafiles and control files as obsolete,
i.e. no longer needed for media recovery, according to criteria that you specify
in the CONFIGURE command.

There are two options to set this,

a) RECOVERY WINDOW

A recovery window is a period of time that begins with the current time and
extends backward in time to the point of recoverability. The point of recoverability
is the earliest time for a hypothetical point-in-time recovery, that is, the earliest
point to which you can recover following a media failure.

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

You can then periodically or regularly issue the REPORT OBSOLETE command to view
obsolete files and DELETE OBSOLETE to delete them. Note that RMAN does not automatically delete these files if a flash recovery area is not defined and used correctly. (10g feature).  The files will be deleted when the DELETE OBSOLETE command is executed.

Delete obsolete is different than delete expired. Backups reported in DELETE  OBSOLETE means this particular backup is not needed for recovery where as DELETE EXPIRED means that a particular backup is not found physically on disk / media during a CROSSCHECK.

b) REDUNDANCY

REDUNDANCY parameter specifies that any number of backups or copies beyond a
specified number need not be retained.

For example, you can specify:

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

RECOVERY WINDOW option is mutually exclusive with the REDUNDANCY option.

By default, the retention policy is configured to REDUNDANCY = 1 to maintain
Compatibility with the behavior of REPORT OBSOLETE in earlier RMAN releases.

If you run the following command, then RMAN returns the retention policy to the
default value:

CONFIGURE RETENTION POLICY CLEAR;

You can also run the following command to disable the retention policy altogether:

CONFIGURE RETENTION POLICY TO NONE;

If the retention policy is configured to NONE, then REPORT OBSOLETE and DELETE
OBSOLETE do not consider any backups to be obsolete.

You can use KEEP clause to exclude that particular backup from retention policy.


2) CONFIGURE BACKUP OPTIMIZATION OFF; # default


If you enable backup optimization, then the BACKUP command skips the backup of a file when the identical file has already been backed up to the allocated device type.

Criteria to Determine an Identical File:

Datafile      :  Same DBID, checkpoint SCN, and RESETLOGS SCN and time.
                                    The datafile must be offline-normal, read-only, or closed normally.

Archived redo log   :  Same thread, sequence number, and RESETLOGS SCN and time.

Backupset      :  Same backup set recid and stamp.

Retention policy and duplexing policy affect this optimization algorithm.

To override backup optimization and back up all files whether or not they have changed, specify the FORCE option on the BACKUP command. To disable backup optimization, specify OFF on the CONFIGURE BACKUP OPTIMIZATION command. The CLEAR option returns backup optimization to its default value of OFF.


3) CONFIGURE DEFAULT DEVICE TYPE TO DISK;


Run the CONFIGURE DEFAULT DEVICE TYPE command to specify a default device
type for automatic channels.

For example, you may make backups to tape most of the time and only occasionally make a backup to disk. In this case, configure channels for disk and tape devices, but make the device of sbt the default device:

CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # configure device disk
CONFIGURE DEVICE TYPE sbt PARALLELISM 2; # configure device sbt

CONFIGURE DEFAULT DEVICE TYPE TO sbt;

RMAN will now only allocate sbt channels when you run backup commands.

RMAN knows the command that is running. For backups, only a single type of channel is allocated. For restores, RMAN knows which device types are required, allocating all necessary channels. Because RMAN has a pre-configured automatic DISK channel, you do not have to manually allocate a maintenance channel when running CHANGE ... AVAILABLE, CROSSCHECK,or DELETE against a file that is only on disk.

When a channel is automatically allocated by RMAN, its name
is in the format ORA_devicetype_n.  For example, ORA_SBT_TAPE_1 or
ORA_DISK_1. Automatic channel allocation also applies to
maintenance commands:  ORA_MAINT_DISK_1, ORA_SBT_TAPE_1.

When parallelizing channels, it may be necessary for each channel to be uniquely identified. A typical example of this is in a Real Application Clusters (RAC) architecture. In the RAC environment, online redo logs are archived to different nodes in a cluster and it is necessary for RMAN to connect to each node to backup the archived logs.

CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT 'node1' PARMS='ENV=(NSR_SERVER=bksvr1)';

Additional properties of a channel maybe specified  such as NAME, PARMS,
CONNECT STRING, DEBUG, FORMAT, TRACE, MAXPIECESIZE, RATE, MAXOPENFILES,
and SEND:

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 2M;
CONFIGURE CHANNEL 2 DEVICE TYPE DISK MAXPIECESIZE = 900K;

To clear the any parameters configured for a particular device type:

RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT CLEAR;


4) CONFIGURE CONTROLFILE AUTOBACKUP OFF;

If CONFIGURE CONTROLFILE AUTOBACKUP is ON (by default it is OFF), then RMAN automatically backs up the control file and the current server parameter file

a) After every BACKUP or COPY command issued at the RMAN prompt.
b) Whenever a BACKUP or COPY command within a RUN block is followed by a command that is neither BACKUP nor COPY.
c) At the end of every RUN block if the last command in the block was either BACKUP or COPY.
d) After database structural changes such as adding a new tablespace, altering the state of a tablespace or datafile (for example, bringing it online), adding a new online redo log, renaming a file, adding a new redo thread, and so forth.

CONFIGURE CONTROLFILE AUTOBACKUP  ON;

If you are not using catalog database, it is recommended that this parameter is configured ON.

5) CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

By default, the format of the autobackup file for all configured devices is the
substitution variable %F.

This variable format translates into c-IIIIIIIIII-YYYYMMDD-QQ, where:

IIIIIIIIII stands for the DBID.
YYYYMMDD is a time stamp
QQ is the sequence in hexadecimal number that starts with 00 and has a maximum of FF (256)

You can change the default format by using the following command, where
Device Specifier is any valid device such as DISK or sbt, and 'string' contains the variable %F and is a valid handle for the specified device:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO 'string';

For example, you can run the following command:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/cf_%F';

You can return the default autobackup format to %F by running this command,
where deviceSpecifier is any valid device such as DISK or sbt:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier CLEAR;

RMAN can create control file autobackups in the flash recovery area. Use the RMAN command:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

to clear any configured format option for the control file autobackup location on disk. Control file autobackups will be placed in the flash recovery area when no other  destination  is configured.

To configure the autobackup of the controlfile to the flash recovery area, you must first clear the format as documented in the 10g Backup and Recovery Advanced User's Guide:

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

Note 302153.1 Auto Control File Backup Not going to Flash Recovery Area


6) CONFIGURE DEVICE TYPE DISK PARALLELISM 1;

The CONFIGURE DEVICE TYPE ... PARALLELISM command specifies the number of channels that  RMAN uses when allocating automatic channels for a specified device type. For example, if  you configure parallelism to 2, then RMAN allocates two channels of the default device type whenever it uses automatic channels.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
new RMAN configuration parameters are successfully stored

The following RMAN output shows that two channels are getting allocated while using backup command

RMAN> backup datafile 3;

Starting backup at 19-APR-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=12 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=16 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/opt/prod92/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05
piece handle=/opt/oracle/product/ora92/dbs/0jgi8ka9_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 19-APR-05

7) CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

This configuration specifies the number of copies of each backup set for DATAFILE
(both datafiles and control files) or ARCHIVELOG files on the specified device type

For example, run the following to make 2 copies:

RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

new RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters are successfully stored

This is an illustration of two backup copies with the above configuration set:

RMAN> backup datafile 3;

Starting backup at 19-APR-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=12 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/opt/prod92/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05 with 2 copies
piece handle=/opt/oracle/product/ora92/dbs/0kgi8kkf_1_1 comment=NONE
piece handle=/opt/oracle/product/ora92/dbs/0kgi8kkf_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 19-APR-05

8) CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

This configuration specifies the number of copies of each backup set for ARCHIVELOG
backups:


RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

new RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters are successfully stored

The following RMAN output reports the 2 backup pieces generated as a result of  the configuration.

RMAN> backup archivelog all ;

Starting backup at 19-APR-05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=167 recid=36 stamp=556028199
input archive log thread=1 sequence=168 recid=38 stamp=556031296
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05 with 2 copies
piece handle=/opt/oracle/product/ora92/dbs/0lgi8na0_1_1 comment=NONE
piece handle=/opt/oracle/product/ora92/dbs/0lgi8na0_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 19-APR-05

9) CONFIGURE MAXSETSIZE TO UNLIMITED;

This configuration is used to set the maximum size of a backupset created during any backup. The maximum size of a backupset must be greater than the size of the biggest file it is to backup.

If we set the maxsetsize to a small value and attempt a backup a datafile of a greater size, an error will be generated.  A backup of a datafile cannot span multiple backupsets.

Example:
Set the maxsetsize to 10M and attempt a backup of a datafile size 450M.

RMAN> CONFIGURE MAXSETSIZE TO 10M;

new RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 10 M;
new RMAN configuration parameters are successfully stored

RMAN> backup datafile 1;

Starting backup at 19-APR-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 04/19/2005 19:11:15
RMAN-06183: datafile or datafilecopy larger than MAXSETSIZE: file# 1 D:\ORACLE\O
RADATA\ORCL10G\SYSTEM01.DBF

RMAN>

In the backup example below, maxsetsize is configured to 500M:

RMAN>  CONFIGURE MAXSETSIZE to 500M;

old RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 100 M;
new RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 500 M;
new RMAN configuration parameters are successfully stored

RMAN> backup database;

Starting backup at 19-APR-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\ORADATA\ORCL10G\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05
piece handle=D:\ORACLE\FLASH_RECOVERY_AREA\ORCL10G\BACKUPSET\2005_04_19\O1_MF_NN
NDF_TAG20050419T191617_16B2XC6S_.BKP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=D:\ORACLE\ORADATA\ORCL10G\SYSAUX01.DBF
input datafile fno=00005 name=D:\ORACLE\ORADATA\ORCL10G\EXAMPLE01.DBF
input datafile fno=00004 name=D:\ORACLE\ORADATA\ORCL10G\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05
piece handle=D:\ORACLE\FLASH_RECOVERY_AREA\ORCL10G\BACKUPSET\2005_04_19\O1_MF_NN
NDF_TAG20050419T191617_16B2ZF1Y_.BKP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:00
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00002 name=D:\ORACLE\ORADATA\ORCL10G\UNDOTBS01.DBF
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05
piece handle=D:\ORACLE\FLASH_RECOVERY_AREA\ORCL10G\BACKUPSET\2005_04_19\O1_MF_NN
NDF_TAG20050419T191617_16B3197R_.BKP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:16
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 19-APR-05
channel ORA_DISK_1: finished piece 1 at 19-APR-05
piece handle=D:\ORACLE\FLASH_RECOVERY_AREA\ORCL10G\BACKUPSET\2005_04_19\O1_MF_NC
SNF_TAG20050419T191617_16B31VDY_.BKP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:10
Finished backup at 19-APR-05

RMAN>

10) CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; (10g only)

Governs archived redo log deletion policy for the flash recovery area.

Possible options :

APPLIED ON STANDBY -  enables flash recovery area to delete archivelogs that are applied on mandatory standby.

NONE  -  enables flash recovery area to delete archivelogs that are backed  up to tertiary device and that are obsolete based on the configured  backup retention policy. This is the default configuration.

CLEAR       -  clears the deletion policy and returns the specified configuration to default value. The default value is NONE.


By default, archived redo log files in a flash recovery area that were backed up to a
tertiary device or made obsolete (as defined by the RMAN retention policy) are eligible for deletion.

However, you can change this default deletion policy using the following RMAN command:

CONFIGURE ARCHIVELOG DELETION POLICY TO [CLEAR | NONE | APPLIED ON STANDBY];


Examples of the CONFIGURE ARCHIVELOG DELETION POLICY Command

When backups of archived redo log files are taken on the standby database:

1. Issue the following command on the primary database:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

2. Issue the following command on the standby database:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

When backups of archived redo log files are taken on the primary database:

1. Issue the following command on the standby database:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

2. Issue the following command on the primary database:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

Reconfiguring the Deletion Policy After a Role Transition :

After a switchover or failover, you may need to reissue the RMAN CONFIGURE
ARCHIVELOG DELETION POLICY command on each database.

If the backup site for archived redo log files remains the same, then do nothing.
Otherwise, you must switch the archivelog deletion policy by issuing the

CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY statement on the database where backups are not taken, and issuing the CONFIGURE ARCHIVELOG DELETION POLICY TO NONE statement on the database where backups are taken.

Viewing the Current Deletion Policy

To view the current setting (APPLIED ON STANDBY, CLEAR, NONE) for a database,
issue the following query:

SELECT NAME, VALUE FROM V$RMAN_CONFIGURATION WHERE
NAME LIKE '%ARCHIVELOG DELETION POLICY%';

NAME VALUE
----------------------------- --------------
ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY

You can also find the existing configuration using the RMAN SHOW ARCHIVELOG

DELETION POLICY command:
RMAN> SHOW ARCHIVELOG DELETION POLICY
RMAN configuration parameters are:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

11) CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/product/ora10g/dbs/snapcf_db10g.f';

When RMAN needs to resynchronize from a read-consistent version of the control file, it creates a temporary snapshot control file. RMAN needs a snapshot control file only when resynchronizing with the recovery catalog or when making a backup of the current control file.

This configuration specifies where the snapshot controlfile is created.

RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\ORACLE\SNAPORA.CTL';

snapshot controlfile name set to: D:\ORACLE\SNAPORA.CTL
new RMAN configuration parameters are successfully stored

12) You can backup a 10g target using a 9i RMAN client, but there are some restrictions
when changing controlfile persistent configuration parameters.

If you change parameters as

CONFIGURE DEVICE TYPE DISK PARALLELISM 2; using a 10g RMAN client and then
connect using a 9i RMAN client:

Recovery Manager: Release 9.2.0.6.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: DB10G (DBID=4244657420)

RMAN> show all;

using target database controlfile instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of show command at 06/03/2005 20:22:25
RMAN-12010: automatic channel allocation initialization failed
RMAN-06466: error parsing configuration string (CONFIGURE DEVICE TYPE DISK PARAL
LELISM 2 BACKUP TYPE TO BACKUPSET;)
RMAN-01005: syntax error: found "backup": expecting one of: ";"
RMAN-01007: at line 1 column 42 file: Configuration Row

Note 307022.1 RMAN Compatibility Oracle8i 8.1.7.4 - Oracle10g 10.1.0.4

provides the explanation and solution to use the 10g RMAN client and clear:

 CONFIGURE DEVICE TYPE disk clear;

13) EXCLUDE FOR TABLESPACE excludes the specified tablespace from BACKUP DATABASE commands. Note that you cannot exclude the SYSTEM tablespace. By default, each tablespace is not excluded, that is, the exclude functionality is disabled. The exclusion is stored as an attribute of the tablespace, not the individual datafiles, so the exclusion applies to any files that are added to this tablespace in the future. If you run CONFIGURE ... CLEAR on a tablespace after excluding it, then it returns to the default configuration of "not excluded."

CONFIGURE EXCLUDE FOR TABLESPACE USERS;

RMAN> REPORT SCHEMA;

Report of database schema
File K-bytes    Tablespace           RB segs Datafile Name
---- ---------- -------------------- ------- -------------------
1        204800 SYSTEM               ***     /opt/oracle/oradata/stby92/system01.dbf
2         20480 UNDOTBS1             ***     /opt/oracle/oradata/stby92/undo01.dbf
3         10240 USERS                ***     /opt/oracle/oradata/stby92/users01.

RMAN> SHOW EXCLUDE;

RMAN configuration parameters are:
CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';

RMAN> backup database;

Starting backup at 07-JUN-05
using channel ORA_DISK_1
file 3 is excluded from whole database backup       <=========> Excluded.
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
input datafile fno=00001 name=/opt/oracle/oradata/stby92/system01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/stby92/undo01.dbf
channel ORA_DISK_1: starting piece 1 at 07-JUN-05
channel ORA_DISK_1: finished piece 1 at 07-JUN-05
piece handle=/opt/oracle/product/920/dbs/02gmdami_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 07-JUN-05

Query V$TABLESPACE via SQL*Plus:


SQL> select name,INCLUDED_IN_DATABASE_BACKUP from v$tablespace;

NAME                           INC
------------------------------ ---
SYSTEM                         YES
UNDOTBS1                       YES
USERS                          NO
TEMP                           YES