Friday, June 10, 2011

Rman Change Command in Oracle


Rman Change Comamnd : Change command update the status of a backup or copy in the RMAN repository.The purpose of the Change command is to change the status of backups, copies, and archived logs in the repository to AVAILABLE or UNAVAILABLE. This feature is useful when a previously unavailable file is made available again, or we do not want a specific backup or copy to be eligible to be restored but also do not want to delete it.

The CHANGE command can alter the repository status of usable backups and copies from prior incarnations.It  removes the catalog records for backups and copies, and update the corresponding records in the target control file to status DELETED. This feature is useful when we remove a file by using an operating system command rather than the RMAN CHANGE command, and want to remove its repository record as well.

Restrictions and Usage Notes :
  • The target instance must be started.
  • The KEEP FOREVER clause requires use of a recovery catalog.
  • we cannot use CHANGE... UNAVAILABLE or KEEP attributes for files stored in the flash recovery area.

The only CHANGE command that requires either a manual or automatic maintenance channel is the CHANGE ... AVAILABLE command. However, a maintenance channel is not required when CHANGE ... AVAILABLE is used with a file that is disk only (that is, an archivelog, datafile copy, or controlfilecopy). Here are the option used with the Change Command :

AVAILABLE  :  Changes the status of a backup or copy to AVAILABLE in the repository. View the status in the LIST output or recovery catalog views.

keepOption   :  Changes the exemption status of a backup or copy in relation to the configured retention policy. For example, specify CHANGE ... NOKEEP to make a backup that is currently exempt from the retention policy eligible for OBSOLETE status.
Note: we cannot use this option with flash recovery area files.

UNAVAILABLE  :   Changes the status of a backup or copy to UNAVAILABLE in the repository. View the status in the LIST output or recovery catalog views. This option is provided for cases when the file cannot be found or has migrated offsite. RMAN does not use a file that is marked UNAVAILABLE in a RESTORE or RECOVER command. If the file is later found or returns to the main site, then use the AVAILABLE option to update its status.

UNCATALOG  :    Removes references to a datafile copy, backup piece, or archived redo log from the recovery catalog, and updates records in the target control file to status DELETED. The CHANGE ... UNCATALOG command does not touch physical backups and copies. Use this command to notify RMAN when a file is deleted by some means other than a DELETE command.
Caution: If we resynchronize from a backup control file, or upgrade the recovery catalog, then uncataloged records can sometimes reappear in the catalog metadata.

Here are few Examples : 

1.) UNAVAILABLE option   :  This example changes the status of backup set 100 as well as all backups of server parameter files created more than a day ago to UNAVAILABLE:

RMAN > CHANGE BACKUPSET 100 UNAVAILABLE;
RMAN > CHANGE BACKUP OF SPFILE COMPLETED BEFORE 'SYSDATE-1' UNAVAILABLE;

2.) Uncataloging and Cataloging Archived Logs  :  In this example, we move all archived logs to a new directory, uncatalog them, and then recatalog them in the new location:

RMAN > HOST move 'D:\archive\'  'D:\stand_arch\' ;
RMAN > CHANGE ARCHIVELOG ALL UNCATALOG;
RMAN > CATALOG START WITH 'D:\stand_arch\';

3.) Changing the Retention Status of a Backupset : This example, which requires a recovery catalog, changes an ordinary backup into a long-term backup:

RMAN > CHANGE BACKUP TAG 'consistent_db_bkup' KEEP FOREVER NOLOGS;


Enjoy      :-)


1 comment:

VISHWANATH SHARMA said...

Congrats neeraj for completing 100 posts.Keep doing the great work:-)