RMAN Backup , List ,Configure and Report Backups




RMAN Backup , List ,Configure and Report Backups
A. Backup a database

RMAN> BACKUP DATABASE;

backup current controlfile
RMAN> BACKUP CURRENT CONTROLFILE;

--backup datafiles
RMAN> BACKUP AS BACKUPSET DATAFILE
'<datafile name>', '<datafile name>';

--backup all datafiles in the database: (bit-for-bit copies, created on disk)
RMAN> BACKUP AS COPY DATABASE;

Backup archive logs:
RMAN> BACKUP ARCHIVELOG TIME BETWEEN 'SYSDATE-10' AND 'SYSDATE-2';

Backup tablespace:
RMAN> BACKUP TABLESPACE system, users, tools;

Backup controlfile:
RMAN> BACKUP CURRENT CONTROLFILE TO DESTINATION '<directory where backup is to be taken>';

Backup parameter file:
RMAN> BACKUP SPFILE;

Backup validation confirms that a backup could be run, by confirming that all database filesexist and are free of physical and logical corruption, this does not generate any output.
BACKUP VALIDATE DATABASE ARCHIVELOG ALL;

backup all archive logs created more than 1 and less than 5 days ago.
BACKUP ARCHIVELOG FROM TIME 'SYSDATE-5' UNTIL TIME 'SYSDATE-1';

backup all archive redo logs created between sequence numbers <startseq> and <tillseq>
BACKUP ARCHIVELOG FROM SEQUENCE <startseq> UNTIL SEQUENCE <tillseq>;

backup all archive redo logs created between SCN <startscn> and <tillscn>
BACKUP ARCHIVELOG FROM SCN <startscn> UNTIL SCN <tillscn>;


Example 1 : To Backup a database with 2 channels (for parallelism) to Tape with 2 files in one backupset at a particular location use :
(for Disk use disk instead of sbt_tape)

run {
allocate channel t1 type SBT_TAPE;
allocate channel t2 type SBT_TAPE;
backup filesperset 2 format ‘/u01/backuploc/df_%t_%s_%p’ database;
}

Example 2 : To Backup a archives with 2 channels (for parallelism) to Tape , and remove the archive after backup use :

run {
allocate channel t1 type ‘SBT_TAPE’;
allocate channel t2 type ‘SBT_TAPE’;
backup format ‘al_%t_%s_%p’ archivelog all delete input;
}

B. LISTING BACKUPS

Listing Incarnations

A new incarnation of the database is created when you perform the open resetlogs operation. To view the list of database incarnations,

RMAN> List incarnation;

List Summary of Backups

The summary of backups include backupset key, the status, device type, completion time etc,

RMAN> List Backup Summary;
RMAN> List expired Backup of archivelog all summary;
RMAN> List Backup of tablespace Users summary;

List Backups of various files

It provides the summary of the backups available for each datafile, controlfile, archivelog file and spfile.

RMAN> List Backup By File;

Detailed Report

If you want the detailed report on the backups, then issue the following command.

RMAN> List Backup;

It lists the all available information about the backups.

Expired Backups

The list backup shows both available and expired backups. To view only the expired backups,

RMAN> List expired Backup;
RMAN> List expired Backup summary;
RMAN> List expired Backup of Archivelog all;
RMAN> List expired Backup of datafile 1;

Listing Tablespace and Datafile Backups

RMAN> List Backup of Tablespace Users;
RMAN> List Backup of Datafile 1;

Listing Archivelog Backups

RMAN> List Archivelog all;
RMAN> List Archivelog all backedup 2 times to device type sbt;

Listing Controlfile and Spfile Backups

RMAN> List Backup of Controlfile;
RMAN> List Backup of Spfile;

The above list commands displayed information about the backusets.
If you have performed Image copy backups then you must use the list copy command as shown below


RMAN> List Copy;
RMAN> List Copy of database;
RMAN> List Copy of tablespace test;
RMAN> List Copy of archivelog all;
RMAN> List Copy of archivelog from sequence 121 until sequence 160;
RMAN> List Copy of Controlfile;
RMAN> List Copy of Spfile;

C. CONFIGURE BACKUPS

Show all configurable settings:
RMAN> SHOW ALL;

Write disk backups to the /tmp directory (%U will be replaced with unique filenames)
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U';

Backup using a flash recovery area rather than disk
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT CLEAR;

Configure RMAN to back up the control file after each backup
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

By default, RMAN automatically names control file backups and stores them in the flash recovery area.
To configure RMAN to write control file backups to the /cfilebackups directory( %F will generate a unique filename) :
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/cfilebackups/cf%F';

Ensure that RMAN retains all backups needed to recover the database to any point in time in the last 7 days:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

Retain three backups of each datafile:
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

Delete backups no longer required by the retention policy:
RMAN> DELETE OBSOLETE

To override the configured retention policy for individual backups - use BACKUP.. KEEP (or CHANGE.. KEEP)

Configure backups to run in parallel by assigning two sbt channels:
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 2;

Reset any CONFIGURE setting to its default by running the command with the CLEAR option
RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;
RMAN> CONFIGURE RETENTION POLICY CLEAR;

D. REPORT BACKUPS

To see what datafiles/tablespaces haven't been backed up in the last 3 days use:
RMAN> report need backup days=3;
To see for which datafiles/tablespaces you haven't got at least 2 copies of backups (Retention policy to REDUNDANCY 2).
RMAN> report need backup redundancy 2;
To see objects which have been created with options like UNRECOVERABLE (for reasons of speed) and have not been backed up yet use:


Tags

Post a Comment

1 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.