Friday, November 30, 2018

Backup Types and Differences

Full backup is complete backup of all the files (that includes every used data block in the file) on the database. RMAN copies all blocks into the backup set or image copy, skipping only data file blocks that have never been used. For a full Image copy, the entire file contents are reproduced exactly. You can perform a full backup with or without RMAN. If you do not use RMAN, then RMAN is called separately to catalog the backup. This means that you can use this backup as a reference backup for an incremental backup with RMAN. Most of the organizations only use them on a periodic basis because they are time consuming. A  Full backup is different from a whole database backup.

Whole backup
Backs up of the control file and all the database files belongs to a database, but this backup is not cataloged, which means that you cannot use it as a reference backup for an incremental backup with RMAN.



In a Full backup all datafile blocks are backed up. As it was said already, a full backup applies to one or more datafiles and up to all of them (database). The opposite of a full backup is an incremental backup. An incremental backup level 0 backs up all datafile blocks that have ever been used, and an incremental level 1 backs up anything that has changed afterwards. One can do full backups with either RMAN or O/S utilities.

A Full backup is non-incremental RMAN backup. Note that "full" does not refer to how much of the database is backed up, but to the fact that the backup is not incremental. Consequently, you can make a full backup of one data file.

Level1 backup: A level 1 backup includes only those blocks that have been changed since the "parent" backup was taken. Remember a parent backup may be either a level 0 or a level 1 backup.

Level 0 backup:  A level 0 incremental backup is physically identical to a full backup and it includes every data block in the file except empty blocks. The only difference is that the level 0 backup is recorded as an incremental backup in the RMAN repository, so it can be used as the parent for a level 1 backup.

Incremental backup:  An incremental backup can be either level 0 or level 1.
1.       Differential Incremental Backup:  When using differential incremental backup (the default type of incremental backup), RMAN looks for changed data blocks which were changed after last level 1 incremental backup. If there's no level 1 backup made before it, it takes a backup of the changed data blocks which were made after level 0 incremental backup.  Differential backups are faster because there are fewer changes stored, but they take longer at recovery time.
2.       Cumulative Incremental Backup:  In a cumulative incremental backup RMAN takes backup of all changed data blocks after level 0 or level 1 incremental backup.  Like a differential backup, incremental backups also back up only the changed data blocks, but an incremental backup only backs up the data that has changed since the last backup.  If the last backup was also an incremental backup, the current incremental backups only records "changes to the changes", a much smaller set of block changes, and hence, a much smaller recovery time than a differential backup.

Tuesday, November 27, 2018

Recovery Catalog

Recovery Catalog is a database schema that contains RMAN metadata for a set of target databases. Recovery catalog needs separate database or we can create one of the databases on the server. For creating catalog follow these steps.

On the Remote Database (Catalog Database): 

  1. Create a user and grant connect,resource and recovery_catalog_owner privileges.
  2. Create a tablespace or make a tablespace as default to the user and give unlimited quota on the tablespace.
  3. Create a listener in Catalog database and TNS in target database.
On the Target Database (Local Database):

  1. Connect to rman target database as $rman target / catalog rcat/rcat@tns
  2. Create catalog as rman>create catalog;
  3. Register database as rman>register database;
  4. Then take the backup RMAN metadata will be stored in the Catalog Database which we have created.








RMAN Backup & Configuration

RMAN is a Oracle Utility to backup, restore and recovery of database.

RMAN configuration for first time:
       Let us assume the database is in NOARCHIVELOG mode (by default). We need to change it to ARCHIVELOG mode for RMAN backup configuration. We can configure RMAN backup with catalog/repository database as well as control file. It is strongly recommended & very good practice to configure RMAN backup with catalog/repository database. 
    
        Catalog/repository database: It’s central repository & it requires separate database for backup operation. All registered target databases information stored in catalog database.
Control file: It contains registered target database information at server level itself & RMAN utility directly connects to target database by command “RMAN target /”
Note: Create catalog/repository database with the help of DBCA.


Follow these steps to configure RMAN backup :


  1. Connect to Target database(Target DB: The database on which Backup & Recovery to be performed) as sysdba.