:

Useful Commands in RMAN

Note: If you want the date in RMAN to be formatted in a specific way, different to the default, have a read of my other article on how to change the RMAN date format.

# Find out the tag for the backup set that you want
RMAN> LIST BACKUP SUMMARY COMPLETED BETWEEN ’25-04-2013 21:00:00′ AND ’25-04-2013 22:00:00′;

# List the backup pieces for a specific TAG
# A TAG is a user defined name which was specified when the backup was created
RMAN> LIST BACKUPPIECE = ‘<TAG>’;

# Summary list of all backupsets
RMAN> LIST BACKUPSET SUMMARY;

# This deletes, with a prompt first, the backupsets with a tag that you specify
# If you omit the “FORCE” word it will prompt you before it deletes the files, so you can check they are the rights ones
RMAN> DELETE FORCE BACKUPSET TAG = <TAG>;

# If you have removed archivelog files you should use this command to remove the reference to them in the catalog
RMAN> CROSSCHECK ARCHIVELOG ALL;

# Once crosschecked, any missing files will be marked as EXPIRED and you can delete the references to them
RMAN> DELETE EXPIRED ARCHIVELOG ALL;

# Control the level of parallelism in a backup job, over riding the default
# You would use multiple channels (C1, C2, etc) to run in parallel
RMAN> ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT ‘D:\rman_level0\%d_%T_%s_%t’;

# You must use the incremental level = 0 command for a full backup which is to be used as part of an incremental strategy
RMAN>  BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL = 0 DATABASE;

# Delete backups of the database, archivelogs and controfiles completed before the specified time, without prompting
RMAN> RUN
{
DELETE NOPROMPT BACKUP OF DATABASE COMPLETED BEFORE ‘TRUNC(SYSDATE-6)’;
DELETE NOPROMPT BACKUP OF ARCHIVELOG UNTIL TIME ‘TRUNC(SYSDATE-3)’;
DELETE NOPROMPT BACKUP OF CONTROLFILE COMPLETED BEFORE ‘TRUNC(SYSDATE-6)’;
}

# Delete, without prompting, all online archivelogs already backed up and created before a specified date
RMAN> RUN
{
DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE ‘(SYSDATE-2)’ BACKED UP 1 TIMES TO DEVICE TYPE = DISK;
}

Like it, share it...

Category: RMAN


Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *