Sunday, May 4, 2008

How to exclude a tablespace from whole database backup

Everyday you take your backup whole database. Suppose in a tablespace the data don't change open or the tablespace contains test data only. Then you might change will backup strategy of your database to exclude certain tablespace. In order to exclude a tablespace you have to issue,

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE users;

Now if you backup your database by,

RMAN> BACKUP DATABASE;

then then RMAN backs up all tablespaces in the database except users tablespace.

You can see which tablespace is excluded from your backup strategy by issue,

RMAN> SHOW EXCLUDE;

In order to skip two tablespaces or more issue command in RMAN twice or more like,
RMAN> CONFIGURE EXCLUDE FOR TABLESPACE DATA01;
RMAN> CONFIGURE EXCLUDE FOR TABLESPACE DATA02;


Here tablespace DATA01, DATA02 will be excluded from backup.

You can override this exclusion feature by explicitly issuing keyword NOEXCLUDE in order to take whole database backup.

RMAN>BACKUP DATABASE NOEXCLUDE;

You can disable the exclusion feature for users tablespace as follows:
RMAN>CONFIGURE EXCLUDE FOR TABLESPACE users CLEAR;

In order to skip READONLY and OFFLINE tablespace you can issue backup database command as,

RMAN>BACKUP DATABASE SKIP READONLY, SKIP OFFLINE;

1 comment:

  1. Good one. How about the recovery if the whole database files gone and you excluded some tablespaces.

    ReplyDelete