Oracle
by Karan Kukreja
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
by Karan Kukreja
What is RMAN and why choose RMAN ?
by Karan Kukreja
Recovery MANager is a utility provided by Oracle (Ver. 8 onwards).
It is used to perform backup and recovery tasks on the databases and automates 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.
by Karan Kukreja
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 Management Software).
Maintains a separate repository of Backup Metadata.
Knows what backup is redundant/obsolete.
by Karan Kukreja
A general Comparison
by Karan Kukreja
by Karan Kukreja
RMAN Basics and Configuration
by Karan Kukreja
Target database - the Oracle database which the backup or recovery
operations are being performed.
RMAN client executable that interprets commands, directs server
sessions to execute those commands, and records its activity in the target database control file (or catalog).
RMAN Channel Connection to the target database. All tasks done by
RMAN are done through this channel. By default only one channel is allocated. 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;
by Karan Kukreja
Media manager - An application required for RMAN to interface with
sequential 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 are
generally 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 recovery catalog schema. That schema will hold all the tracks. Once the recovery catalog schema is created , it needs to be registered with the target database for achieving the desired functionality. It is optional.
by Karan Kukreja
10
RMAN works only when the database is set in the Archive log mode, although
it works in the noarchive log mode also , but for taking the backups , it is required 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 it
can 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, after configuring the SBT. (To configure the Tape setup).
Only backup set backups can be written onto the tape , image copies cannot be
written onto the tapes.
by Karan Kukreja
11
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 delete obsolete 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;
by Karan Kukreja
12
Backup Options under RMAN Backup set and image copy
by Karan Kukreja
13
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';
by Karan Kukreja
14
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;
by Karan Kukreja
15
Is RMAN hot or cold ?
Its BOTH
RMAN HOT and COLD BACKUP
by Karan Kukreja
16
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 is inconsistent 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. Usefull across all production systems.
by Karan Kukreja
17
Cold Backup
Follows three simple processes: Shutdown the database Start the database in mount state Start the backup OPEN the database
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 no activity is going on , so the database is already in the consistent state.
by Karan Kukreja
18
Do I really need to take the Full backup every
time?
by Karan Kukreja
19
A full backup is the complete backup of the
database/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.
by Karan Kukreja
20
The purpose of the incremental backup is to backup only those
datablocks 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 been updated 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
by Karan Kukreja
21
Differential backup backs up all the blocks that have
changed after level 1 or level 0 backup.
by Karan Kukreja
22
The Cumulative backup backs up all the blocks that
have got updated after Level 0.
by Karan Kukreja
23
Recovery Speed : Cumulative backups are faster to restore
from than differential backups because fewer incremental backups need to be applied during recovery.
backups run faster than cumulative backups because to dont duplicate the work done by previous backups. However, differential backups take longer when doing a recovery. space because they duplicate the work done by previous backups.
by Karan Kukreja
Backup speed: For daily backup speed, differential
Disk space usage: Cumulative backups take more disk
24
Are you all Still with me ? Lets take a tour through
RMAN
by Karan Kukreja
25
by Karan Kukreja
26
by Karan Kukreja
27
by Karan Kukreja
28
by Karan Kukreja
29
by Karan Kukreja
30
by Karan Kukreja
31
by Karan Kukreja
32
by Karan Kukreja
33
by Karan Kukreja
34
by Karan Kukreja
35
by Karan Kukreja
36
by Karan Kukreja
37
by Karan Kukreja
38
by Karan Kukreja
39
by Karan Kukreja
40
by Karan Kukreja
41
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
by Karan Kukreja
42
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
43