Thursday, May 14, 2015

RMAN Commands


1- Connect after setting up the environment 

rman target /

2- SHOW ALL;
will list the configuration of RMAN 

3- Configure RMAN Channel 

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/rman/full_%u_%s_%p';

4- Retention Policy 

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

5- Clear a Parameter: If you want to clear a parameter and set its value to default,  

RMAN> CONFIGURE RETENTION POLICY CLEAR;

6- Typically we’ll use “BACKUP AS BACKUPSET” to backup a database. So, to take a full backup of the database without the archive logs,

RMAN> BACKUP AS BACKUPSET DATABASE

7- To take a full backup of the database with the archive logs, do the following:

RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;

8- You can also take a backup of only a specific table space

RMAN> BACKUP AS BACKUPSET TABLESPACE PRD01;

9- The following example assign a backup tag called “WEEEKLY_PRD01_TBLS_BK_ONLY” to this particular backup.
(Once the backup is finished, if you view the files from rman directory, you’ll not see the tag name here. Tag name is used only from RMAN repositories to view and restore backups)


RMAN>BACKUP AS BACKUPSET TAG 'WEEEKLY_PRD01_TBLS_BK_ONLY' TABLESPACE PRD01;

10- Change Oracle RMAN Backup File Name Format

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   "/backup/rman/full_devdb_bk_%u_%s_%p" MAXPIECESIZE 2048 M;

11- The following example take a compressed backup of the tablepsace PRD01. (The way to tell whether RMAN has take a compressed backup or not, it by looking at the size, and by looking at the output of the RMAN “list” command)

RMAN> BACKUP AS COMPRESSED BACKUPSET TAG 'WEEEKLY_PRD01_TBLS_BK_ONLY' TABLESPACE PRD01;

RMAN> LIST BACKUP SUMMARY;

Also, when the RMAN backup is running, if you want to see the proress, you can query the V$RMAN_STATUS table from sql*plus as shown below.

SQL> SELECT OPERATION, STATUS, MBYTES_PROCESSED, START_TIME, END_TIME from V$RMAN_STATUS;



No comments:

Post a Comment