C Gen Square acle Resource Center


                   RMAN                             back

What is Rman?

                                                    
Recovery Manager is a tool that manages the process of creating backup and also manages the process of restoring and recovering them.
In addition to RMAN repository records, the recovery catalog can also hold RMAN stored scripts, sequences of RMAN commands for common backup tasks. Centralized storage of scripts in recovery catalog can be more convenient than working with command files

Why use Rman ?

 

Understanding The Rman Architecture
An Oracle Rman comprises of
RMAN Executables   This could be present and fired even from client side
Target Databases      This is the database which needs to be backed up
Recovery Catalog      Recovery Catalog is optional otherwise backup                 
backup details are stored in target  database  control file


It is a repository of information queried and updated by Recovery Manager
It is a schema or user stored in Recovery Manager
One schema can support many databases
It contains information on Physical schema  of Target Database
data file and archive log, backup sets and  pieces

Recovery Catalog is  a must in following scenarios

Media Management Software
Media management software is a must  if you are using  RMAN for storing backup in tape drive directly

Backups in Rman
Oracle backup in RMAN are the following type
RMAN complete backup
RMAN incremental backup
These backup are  of RMAN proprietary nature

Image copy
The advantage of image copy is it is not in RMAN proprietary format

 

BackupFormat
RMAN  backup is not  in oracle format but in RMAN format.
Oracle backup comprises of backup  sets and consists of backup peices
Backup sets are logical entity
In Oracle 9i it gets stored in default locations
There are two type of backup sets
Datafile backup sets, Archivelog Backup sets
One more important point of data file  backup sets is it  donot include empty blocks, 
A backup set will contain many backup pieces
A single  backup piece  consists of physical files which are  in RMAN proprietary format.

Backups in Rman
Oracle Backup in RMAN are thefollowingtype
Backup complete backup ;
Image Copy
Backup Format
Example of Using Backup  Using Rman..

 

Taking RMAN backup
In non archive mode in dos prompt type
RMAN

RMAN   > Connect Target
Connect to target database : Magic < Dbid= 129283912>
Using target database controlfile instead of recovery catalog

Let us take a simple backup of database in Non Archive Mode
Shutdown immediate;         -   Shutdown The database;
Startup mount;
Backup database;                 -- This starts backing the database
Alter database open;

We can  fire the same commands in archive log mode
And whole of datafiles will be backed
Backup database plus archivelog;

Restoring Database
Restoring database has been made very simple in 9i .
It is just restore database.
Rman is intelligent to identify which dataifiles has to be restored and the locations of backed up file.

Oracle Enhancement for Rman in 10g
Flash Recovery Area
Incrementally Updated Backups
Faster Incremental Backups
SWITCH DATABASE COMMAND.
Binary Compression
Global Scripting
Duration Clause
Configure This
Oracle Enhancement for Rman in 10g
Automatic Channel Failover
Compress Backup Sets
Recovery Through Reset Logs
Cross Backup Sets

 

Flash  Backup and Recovery Area
With ever decreasing cost of disk in the market place ,disk based backups are more feasible.  A The major advantage of flash backup and recovery area is once when the hard disk gets filled Automatically obslete backups are deleted reducing the need of DBA to do such tasks.
Or backups whose  archive logs have been already been backed up are automatically deleted

 

The flash Recovery area notifies the administrator when the disk space consumption is nearing the defined quota and there is  no more files to purge.

Incrementally Updated Backups
You can apply incremental backups to your datafile image  copies when you use the RMAN. This takes much less time  then performing  a full image copy of datafiles every day.
This is applied through two phases.

  • Apply the incremental backup to datafile  image copies .This is done at database block level.
  • Then apply the archive logs since the last incremental backup only .This is done at transaction level (Slower than previous phase)

Below you can see the example of incrementally updated Backups
Backup incremental level 0 tag = weekly database;    -- This takes a full database backup .
The remaining days .. The below script works which  creates a  incremental backup (Note the speed of incremental backup could be increased by using block change tracking file which is mentioned below ) and the  recover copy with tag weekly database   is used to add the incremental  to the  full backup .

Backup incremental level 1
For recover of copy
With tag weekly database;

Recover copy  of database
With tag weekly;

Faster Incremental Backup
Sql
alter database enable block change tracking using file ‘c:\cpisolution\bij.dbf’ ;

 

SWITCH DATABASE COMMAND.
The rman simply adjusts the pointers for the datafiles in controlfiles so they point to backup files in your flash recovery area. Advantage of this method is quicky recoverey.  No need to restore the data files from tape or hard disk.
Following are the commands for it
Restore Database to Copy;
Before applying this command the database  has to be in mount mode
You then recover the database using recover database command;
This will apply all the logs;

 Disadvantage is  it  is only a  temporary solution since
backups are stored in flash recovery area.

Global  Scripting
RMAN> print script full_backup to file 'my_script_file.txt'
Oracle Database 10g provides a new concept of global scripts, which you can execute against any database registered in the recovery catalog, as long as your RMAN client is connected to the recovery catalog and a target database simultaneously.
RMAN> create global script global_full_backup
{ backup database plus archivelog;
delete obsolete;
delete global script ‘full_backup’;
List Script Names;
Run  { Execute Global  Script  global_backup_db;}
Global RMAN Scripts

 

Duration Clause

BACKUP DURATION 4:00 PARTIAL
 MINIMIZE TIME DATABASE FILESPERSET 1;

You can limit the time the backup is going to takeplace by this command

 

Automatic Channel Failover
In Oracle 10g  the behaviour of  RMAN  changes with regard to the failure of a channel During  a RMAN backup . In Oracle Database 10g if a channel fails.  The backup process On that channel fails and will not be restarted.  However backups on remaining channels Will  continue to run.
Once the backup process is complete RMAN will report errors  that
Occurred during the backup process.

 

 

 

Compressed BackupSets
Backup as  compressed backupset  database;
Note that only backupsets can be compressed ( eg database,tablespace and datafile backups)
Specially image copies cannot be compressed. 

Rman >  configure device type  disk backup type to compressed backupset;
Binary compression technique reduces backup space usage  50-75 %

 

 

 

Recoverey Through ResetLogs
Prior to Oracle Database 10g it is recommended practice to make a full database backup following resetlogs. This is no longer required since backup can be used before resetlogs.

These are Oracle 9I Enhancement in Rman

9 I New Features                                 

Persistent Rman Configuration
Configure This
Configure Retention Policty  To Recovery Window of 5 days
Retention Policy determines the  length of time   a backup is retained for use in a potential restore.
A recovery window  is a period of time that begins with the current time and extends backward  in time to point  of recoverability.

Configure Retention policy  to redundancy 3;
All backups older than  the most recent backup that satisfied the above conditions are obsolete.
The recovery window always  keeps in pace with the current time.
Specifying redundancy by using the CONFIGURE RETENTION POLICY TO REDUNDANCY command:
The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number does not need to be retained.
For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; command specifies that a maximum of three backups or copies of a data file or control file can be retained. Redundancy is the default type of retention policy.

 

Configure Backup Optimization On
Read only tablespace or datafiles  are backed only  once per recovery window
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 /test directory:
( %F will generate a unique filename)
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
FOR DEVICE TYPE DISK TO '/test/cf%F';

 

 

 

Block Media Recovery
Allows specified blocks to be recovered without affecting the entire datafile..  It is only intended for use where a  known and limited number of block is affected. This results in a reduced mean time  to recover (MTTR)  and higher availability as only the affected blocks are offline during operation
The information regarding which block has to be recovered in found in

The alert log file, Trace File,Analyze Table Command, Dbverify utility,V$Backup_Corruption & V$Copy_Corruption command.
Example of Using Block Recovery in RMAN.
BLOCKRECOVER DATAFILE 3 BLOCK 121;

 

 

Trial Recovery
You can determine the outcome of a recovery before actually doing it for real by appending the work "test" to any recover command. The following command will cause Oracle to perform a dry-run of a recovery without actually changing any data:

SQL> recover database until cancel test; 

 

 

 

Oracle Enterprise Manager
has also been configured in such a manner that it makes it easy to manage  all rman backups and restore operations.
It has  buttons for quick  crosschecks,  showing current backups, implementing fast recovery ,changing basic rman configuration ,etc

 

Archive Log Failover
Archive log failover allows RMAN can take advantage of multiple archive logs destinations such that, if a corrupt log is detected it can read the log from the alternate destination

Obselete
Delete obselete;  will delete all obselege backups.
Expired are those backups which donot exist in the media.

Auto Backp of Control file
Whenever there is a  structure change
Aditonally It Supports

  • Backup of Server Parameter File
  • Parrallel Operation Supported
  • Extensive Reporting Available
  • Scripting
  • Duplex Backup sets
  • Corrupt Block Detection
  • Backup archive Logs

 

 

 

Oracle 9i Rman New Features

 

Misc Rman Commands
Show all :---   Displays all the rman configuration for the particular target database
Example show all
Configure retunetion policty to reduncandacncy1
Backup optimization off
Default device type to disk
Controlfile autobackup off
Encryption to database off;

Observation
Introduced in Oracle 8i it has become more powerful and simpler with the  newer version of Oracle9 and Oracle 10g ..
So if you really dont want to miss something critical please start using RMAN.

Paul Johny
Ocp 8 8i 9i 10g DBA
WWW.CPISOLUTOIN.COM\ORACLE.HTML