RMAN - II (Catalog, FRA, Script)


Catalog (tables & views)  à Central repository that stores information of backups.
Configure catalog:
In a separate box (machine) install Oracle software the version must be same or higher from the Target databases and configure the Listener and do the following:

Steps:
a)      Create a new database for the catalog : hzcat
b)     Create a tablespace: hzts
c)      Create a user: hzrman and assign the above tablespace hzts as default
d)     Grant connect, resource and recovery_catalog_owner privileges to hzrman user
i)      Sql>grant connect,resource,recovery_catalog_owner to hzrman
e)      connect to RMAN and create the catalog:

$rman catalog hzcat/passwd
Rman> create catalog;

For each Target database site

Configure tns service for recovery catalog:  tohzcat and register the database
 
$rman target / catalog rmanuser/rmanuser@tocat

        Rman>register database;

Note: Continue same for other target databases

Taking backup of Target db with Catalog
From the Target host connect to rman,

$export ORACLE_SID=prod
$rman target / catalog hzcat/passwd@tohzcat
Rman> backup database;

Run block:
        To execute multiple commands at a time.        
 Rman>run
                  {
                     backup current controlfile;
                     backup datafile 1;
                  }

Configure FRA (flash recovery area)
            Configure parameters
                 db_recovery_file_dest_size
                 db_recovery_file_dest
          Sql>alter system set db_recovery_file_dest_size=4g scope=both;
          Sql>alter system set db_recovery_file_dest=’/u01/user18/fra’ scope=both;
  
Configure commands
Rman> configure controlfile autobackup on;   à on backup of database/datafile controlfile & spfile will auto backed up
              Rman> configure retention policy to redundancy 2; 
                                      OR
            Rman> configure retention policy to recovery window of 30 days;
            Rman>configure backup Optimization on;
  
Rman Scripts

1. Creating Rman Script:
    Eg:
Rman>create script coldbkp
{
   Shutdown immediate;
   Startup mount;
   Backup database include current controlfile;
   Sql ‘alter database open’;
}
2. Executing rman script
   Rman>run {execute script coldbkp};
3. To see the code of script:
Rman>print script coldbkp;
Rman>delete script coldbkp;

View: we can check following views to see rman scripts
           rc_stored_script //display scripts name
           rc_stored_script_line // display text of script
Note: we can create rman script in catalog mode only.

Os Script:
At OS prompt:
 $vi hotbkp.sh
             #! /bin/bash
             rman target / catalog rmanuser/rmanuser@tocat<<!
            Backup database;
            Exit
 Wq!

Run the script:
      $sh hotbkp.sh
Bkup.cmd
Rman>

No comments:

Post a Comment