RECOVERY MANAGER BASIC COMMANDS.

RECOVERY MANAGER(RMAN)  COMMANDS.

In this article , we will see all the best practices of RMAN commands.

Oracle Recovery Manager (RMAN) satisfies the most pressing demands of performance, 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.

2) Shows the archivelog deletion policy.

3) Shows the number of archivelog backup copies

4) Shows the auxiliary database information.

5) Shows whether optimization is on or off.

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

7) Shows the characteristics of the channel

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

9) Shows the format of the autobackup control file

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

11) Shows the default type (disk or tape)

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

13) Shows the encryption algorithm currently in use.

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

15) Shows the tablespaces excluded from the backup.

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

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

18) Shows the snapshot control filename.

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

 

**BACKUP COMMAND**

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

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

3) To back up the server parameter file

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

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

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

7) To backup database plus archivelogs

8) To backup all archive logs

9) To backup specific data file

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

 

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

2) Add uncataloged backup piece to RMAN repository

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

 

**REPORT COMMAND**

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

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

3) To reports on any obsolete backups

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.

2) List the backups by just the backup files

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

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

5) Lists backups by tag:

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

7) Lists all incarnations of a database

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

9) Lists the names of all recovery catalog scripts

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

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

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

13) To view all the restore points in the database

 

**CROSSCHECK COMMAND**

1) Cross-checking just backup sets

2) Cross-checking a copy of a database

3) Cross-checking specific backupsets

4) Cross-checking using a backup tag

5) Cross-checking a control file copy;

6) Cross-checking backups completed after a specific time

7) Cross-checking of all archivelogs and the spfile

8) Cross-checking all backups on disk and tape

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 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

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

4) To delete copy of controlfile under /backups

5) To delete backups with specific tag

6) To delete bakups of specific tablespace

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

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

8) To delete already backed up archived redo logs

9) To delete specific archived redo logs

10) Delete archive logs after taking backup

11) Delete stored script

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:

 

**CHANGE COMMAND**

1) Change the status of a backup set to 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

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:

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

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

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

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

The check logical clause means that RMAN will check for logical corruption only.
3) To validate a single backup set

4) To validate all datafiles at once

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

6) To validate all the recovery related files

7) To validate the spfile

8) To validate specific tablespace

9) To validate specific control file copy

10) To validate specific backupset

 

Please comment if any other commands you know …….

Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Add Comment