RMAN Basics Oracle - applicable for all oracle versions

Embed Size (px)

Citation preview

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    1/43

    Oracle

    1by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    2/43

    What is RMAN and why RMAN ?

    A General Comparison

    RMAN Basics and Configuration

    Backup options with RMAN Hot and Cold Backup

    Incremental and Full Backup

    Demo Slides for understanding

    References

    2by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    3/43

    What is RMAN and why choose RMAN ?

    3by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    4/43

    RecoveryMANager is a utility provided by Oracle (Ver. 8 onwards).

    It is used to perform backup and recovery tasks on the databases andautomates administration of the backup strategies.

    It greatly simplifies backing up, restoring, and recovering database files.

    Since its a free utility can be easily adopted by DBAs without extra cost.

    Can be used to backup the entire database.

    Enables DBA to take complete backup every time or only the modified

    Data.

    Allows the users to compress the backup set.

    4by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    5/43

    Enables parallel backups.

    RMAN generates a log of all the backup it takes.

    Allows hot and cold backups.

    Stores the backup on tape rather than disk.( Requires Media ManagementSoftware).

    Maintains a separate repository of Backup Metadata.

    Knows what backup is redundant/obsolete.

    5by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    6/43

    A general Comparison

    6by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    7/43

    7by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    8/43

    RMAN Basics and Configuration

    8by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    9/43

    Target database - the Oracle database which the backup or recoveryoperations are being performed.

    RMAN client executable that interprets commands, directs serversessions to execute those commands, and records its activity in the targetdatabase control file (or catalog).

    RMAN Channel Connection to the target database. All tasks done byRMAN are done through this channel. By default only one channel isallocated. By default , all the backups are stored at the location :

    $ORACLE_HOME/dbs path.

    To change the location we use the following command :Configure channel device type disk format /u01/app/oracle/RMAN_NEW;

    9by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    10/43

    Media manager - An application required for RMAN to interface withsequential media devices such as tape libraries.

    A media manager controls these devices during backup and recovery,managing the loading, labeling, and unloading of media.

    It is optional to use this.

    Recovery catalog All the tracks of activities done by RMAN aregenerally stored in the control file of the target database. This is not a good practice and the alternate method is to create

    another database called the recovery database which has a recoverycatalog schema.

    That schema will hold all the tracks. Once the recovery catalog schema

    is created , it needs to be registered with the target database forachieving the desired functionality. It is optional.

    10by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    11/43

    RMAN works only when the database is set in the Archive log mode, althoughit works in the noarchive log mode also , but for taking the backups , it isrequired to shutdown the database. dThese backups are just like Cold Backups.

    RMAN does not backup the control file until and unless its a full backup , but itcan be changed to always backup the control file with the following command:

    enable controlfile autobackup on;

    RMAN can be used to backup/restore/recover only datafiles, archive files,control files and spfile. It cannot include the redolog file.

    All the backups made by RMAN are stored in the Operating system specific

    location but it can be configured to be backed up on devices like tape, afterconfiguring the SBT. (To configure the Tape setup).

    Only backup set backups can be written onto the tape , image copies cannot bewritten onto the tapes.

    11by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    12/43

    Retention Policy We can configure a backup retention policy in RMAN , which means

    we can decide for how long in future do we need to keep the backup. Once the backup gets older than the time specified in the retention

    policy , it is marked as obsolete.

    List obsolete command will now show this in the list and deleteobsolete will delete this backup from the list.

    rman> configure retention policy to recovery window of 28 days;

    This will keep a backup non-obsolete for 28 days. To remove from the retention policy give the command:

    rman> Configure retention policy clear;

    12by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    13/43

    Backup Options under RMAN

    Backup set and image copy

    13by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    14/43

    Logical backup of the database. Creates a backup Piece( Physical) where the backup resides. Takes backup of only used datablocks. One backup set will create only one backup piece. It can be used to backup the datafiles, controlfiles, archived redo logs

    and current Spfile. Backup can be backed up to tape.

    For example:

    rman>BACKUP DATABASE; rman>BACKUP TABLESPACE USERS; rman>BACKUP (SPFILE) (CURRENT CONTROL FILE); rman>BACKUP DATAFILECOPY '/tmp/system01.dbf';

    14by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    15/43

    Bit by Bit duplication of the data file. Identical copy made of the database. Include the free and corrupted blocks also for copying. Just works like operating system copy command( cp).

    The Image backup cannot be copied on the tape. Spfile cannot be backed up using image copy. as copy keywords as used to signify image copy.

    For Example:

    rman> BACKUP AS COPY DATABASE; rman>BACKUP AS COPY TABLESPACE USERS;

    15by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    16/43

    Is RMAN hot or cold ?Its BOTH

    RMAN HOT and COLD BACKUP

    16by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    17/43

    Hot Backup

    Taking the backup while the database is up and running.

    This does not involve shutting down the database instance while the database is undergoing backup.

    Could be Full or incremental.

    Example :

    Connect to the rman :

    $ rman

    rman>backup database;

    rman>backup arcvhivelog all;

    This will backup the database while its still running. What is important here is that we need to backup the

    archive logs also to ensure that the backup is consistent. A backup without the archivelog backup isinconsistent and cannot be used to restore the database.

    Rman is mostly used for taking this HOT backup as this gives a backup without taking any downtime. Usefullacross all production systems.

    17by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    18/43

    Cold Backup

    Follows three simple processes:

    Shutdown the database Start the database in mount stateStart the backupOPEN thedatabase

    For Example :

    $ rman

    rman>shutdown immediate;

    rman>startup mount

    rman>backup database;

    rman>sql alter database open;

    Here we need not take archive log backup because the database is in mount state and noactivity is going on , so the database is already in the consistent state.

    18by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    19/43

    Do I really need to take the Full backup everytime?

    19by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    20/43

    A full backup is the complete backup of thedatabase/tablespace/datafiles.

    This is performed using a simple query :

    Backup database;

    It can be either Hot ( when database is running) or Cold(

    when database is in mount state).

    A full backup will be either a backup set or Image copy.

    20by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    21/43

    The purpose of the incremental backup is to backup only thosedatablocks that have changed since the last backup.

    In this way backup will be of lesser size and faster( Generally). Algorithm used : Each datablock has a SCN ( System Change Number).

    During incremental backup it will check if the SCN has beenupdated post old backup. If yes , it will backup that datablock else ignore it.

    Incremental backup is of 2 types : Level 0 Like Full backup, backs up entire data. Level 1

    Differential Cumulative

    21by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    22/43

    Differential backup backs up all the blocks that havechanged after level 1 or level 0 backup.

    22by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    23/43

    The Cumulative backup backs up all the blocks thathave got updated after Level 0.

    23by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    24/43

    Recovery Speed : Cumulative backups are faster to restorefrom than differential backups because fewer incrementalbackups need to be applied during recovery.

    Backup speed: For daily backup speed, differentialbackups run faster than cumulative backups because todont duplicate the work done by previousbackups. However, differential backups take longer whendoing a recovery.

    Disk space usage: Cumulative backups take more diskspace because they duplicate the work done by previousbackups.

    24by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    25/43

    Are you all Still with me ? Lets take a tour throughRMAN

    25by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    26/43

    26by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    27/43

    27by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    28/43

    28by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    29/43

    29by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    30/43

    30by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    31/43

    31by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    32/43

    32by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    33/43

    33by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    34/43

    34by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    35/43

    35by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    36/43

    36by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    37/43

    37by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    38/43

    38by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    39/43

    39by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    40/43

    40by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    41/43

    41by Karan Kukreja

  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    42/43

    http://download.oracle.com/ http://metalink.oracle.com

    http://www.dba-oracle.com/t_rman_backup_types.htm

    http://www.cuddletech.com/articles/oracle/node59.html

    42by Karan Kukreja

    http://download.oracle.com/docs/cd/B10500_01/server.920/a96566/rcmconc1.htmhttp://metalink.oracle.com/http://www.dba-oracle.com/t_rman_backup_types.htmhttp://www.cuddletech.com/articles/oracle/node59.htmlhttp://www.cuddletech.com/articles/oracle/node59.htmlhttp://www.dba-oracle.com/t_rman_backup_types.htmhttp://www.dba-oracle.com/t_rman_backup_types.htmhttp://www.dba-oracle.com/t_rman_backup_types.htmhttp://www.dba-oracle.com/t_rman_backup_types.htmhttp://metalink.oracle.com/http://download.oracle.com/docs/cd/B10500_01/server.920/a96566/rcmconc1.htm
  • 7/29/2019 RMAN Basics Oracle - applicable for all oracle versions

    43/43

    Thank You for watching this slide.

    For any questions / queries/ comments you can reach

    me at : [email protected]

    https://www.facebook.com/groups/141825412627443/

    by Karan Kukreja

    mailto:[email protected]://www.facebook.com/groups/141825412627443/https://www.facebook.com/groups/141825412627443/mailto:[email protected]