RMAN Basics Oracle - Applicable For All Oracle Versions
RMAN Basics Oracle - Applicable For All Oracle Versions
by Karan Kukreja
A General Comparison
RMAN Basics and Configuration Backup options with RMAN
References
by Karan Kukreja
by Karan Kukreja
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.
by Karan Kukreja
A general Comparison
by Karan Kukreja
by Karan Kukreja
by Karan Kukreja
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 :
by Karan Kukreja
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;
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
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
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
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
time?
by Karan Kukreja
19
database/tablespace/datafiles.
This is performed using a simple query :
Backup database;
It can be either Hot ( when database is running) or Cold(
20
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
by Karan Kukreja
22
by Karan Kukreja
23
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
24
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
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