You are on page 1of 5

Author: Anup Kumar Srivastav

Topic: RMAN Basic


RMAN Basic
Oracle provides a tool for Database backup and restore operation is called RMAN Recover! Mana"er is a
client#server application that uses database server sessions to perform backup and recover! $t stores
metadata about its operations in the control file of the tar"et database and% optionall!% in a recover! catalo"
schema in an Oracle database if usin" catalo"
Difference between RMAN and Traditional backup methods
RMAN is Oracle&s backup and recover! utilit! 'ith RMAN% backups become as eas! as:
BA(K)* DATABAS+,
RMAN reduces the comple-it! of backup and recover! RMAN can determine .hat needs to be backed up
or restored
B! usin" operatin" s!stem commands for )ser/Mana"ed Backup and Recover!% a DBA manuall! keeps
track of all database files and backups But RMAN performs these same tasks automaticall!
Why should we use RMAN
Abilit! to perform incremental backups
Abilit! to recover one block of a datafile
Abilit! to perform the backup and restore .ith paralleli0ation
Abilit! to automaticall! delete archived redo lo"s after the! are backed up
Abilit! to automaticall! backup the control file and the S*1$2+
Abilit! to restart a failed backup .ithout havin" to start from the be"innin"
Abilit! to verif! the inte"rit! of the backup
Abilit! to test the restore process .ithout havin" to actuall! perform the restore
About the RMAN Repository
The RMAN repositor! is a set of metadata that RMAN uses to store information about the tar"et database
and its backup and recover! operations RMAN stores information about:
Backup sets and pieces
$ma"e copies 3includin" archived redo lo"s4
The tar"et database schema
*ersistent confi"uration settin"s
$f !ou start RMAN .ithout specif!in" either (ATA2O5 or NO(ATA2O5 on the command line% then
RMAN makes no connection to a repositor! $f !ou run a command that re6uires the repositor!% and if no
(ONN+(T (ATA2O5 command has been issued !et% then RMAN automaticall! connects in the default
NO(ATA2O5 mode After that point% the (ONN+(T (ATA2O5 command is not valid in the session
Types of Database Connections
7ou can connect to the follo.in" t!pes of databases
Tar"et database
RMAN connects !ou to the tar"et database .ith the S7SDBA privile"e $f !ou do not have this privile"e%
then the connection fails
Recover! catalo" database
This database is optional: !ou can also use RMAN .ith the default NO(ATA2O5 option
Author: Anup Kumar Srivastav
Topic: RMAN Basic
Au-iliar! database
7ou can connect to a standb! database% duplicate database
Note:
That a S7SDBA privile"e is not re6uired .hen connectin" to the recover! catalo" The onl!
re6uirement is that the R+(O8+R79(ATA2O59O'N+R role be "ranted to the schema o.ner
sin! Basic RMAN Commands
After !ou have learned ho. to connect to a tar"et database% !ou can immediatel! be"in performin" backup
and recover! operations )se the e-amples in this section to "o throu"h a basic backup and restore scenario
usin" a test database These e-amples assume the follo.in":
The test database is in AR(:$8+2O5 mode
7ou are runnin" in the default NO(ATA2O5 mode
The RMAN e-ecutable is runnin" on the same host as the test database
(onnectin" to the Tar"et Database
rman TAR5+T #
$f the database is alread! mounted or open% then RMAN displa!s output similar to the follo.in":
Recover! Mana"er: Release ;<===
connected to tar"et database: RMAN 3DB$D>?<@AB=@<;C
Reporting the Current Schema of the Target Database
$n this e-ample% !ou "enerate a report describin" the tar"et datafiles Run the report schema command as
follo.s:
RMAND R+*ORT S(:+MA, 3RMAN displa!s the datafiles currentl! in the tar"et database
Listing Backups and Copies
To list the backup sets and ima"e copies that !ou have created% run the list command as follo.s:
RMAND 2$ST BA(K)*,
To list ima"e copies% run the follo.in" command:
RMAND 2$ST (O*7,
Validating the Restore of a Backup
(heck that !ou are able to restore the backups that !ou created .ithout actuall! restorin" them Run the
R+STOR+ 8A2$DAT+ command as follo.s:
RMAND R+STOR+ DATABAS+ 8A2$DAT+,
Backing Up the Database
$n this task% !ou back up the database to the default disk location Because !ou do not specif! the format
parameter in this e-ample% RMAN assi"ns the backup a uni6ue filename
Author: Anup Kumar Srivastav
Topic: RMAN Basic
7ou can make t.o basic t!pes of backups: full and incremental
Making a Full Backup
Run the backup command at the RMAN prompt as follo.s to make a full backup of the datafiles% control
file% and current server parameter file 3if the instance is started .ith a server parameter file4 to the default
device t!pe:
RMAND BA(K)* DATABAS+,
Making an ncremental Backup
$ncremental backups are a convenient .a! to conserve stora"e space because the! back up onl! database
blocks that have chan"ed RMAN compares the current datafiles to a base backup% also called a level =
backup% to determine .hich blocks to back up
RMAND BA(K)* $N(R+M+NTA2 2+8+2 ? DATABAS+,
Backing Up !rchi"ed Logs
T!picall!% database administrators back up archived lo"s on disk to a third/part! stora"e medium such as
tape 7ou can also back up archived lo"s to disk $n either case% !ou can delete the input lo"s automaticall!
after the backup completesTo back up all archived lo"s and delete the input lo"s 3from the primar!
archivin" destination onl!4% run the backup command at the RMAN prompt as follo.s:
RMAND BA(K)* AR(:$8+2O5 A22 D+2+T+ $N*)T,
Type of RMAN Backup Tutorial
"ull Backups
A full backup reads the entire file and copies all blocks into the backup set% onl! skippin" datafile blocks
that have never been used

About #ncremental Backups
RMAN create backup onl! chan"ed block since a previous backup 7ou can use RMAN to create
incremental backups of datafiles% tablespaces% or the .hole database
$ow #ncremental Backups Work
+ach data block in a datafile contains a s!stem chan"e number 3S(N4% .hich is the S(N at .hich the most
recent chan"e .as made to the block Durin" an incremental backup% RMAN reads the S(N of each data
block in the input file and compares it to the checkpoint S(N of the parent incremental backup RMAN
reads the entire file ever! time .hether or not the blocks have been used
The parent backup is the backup that RMAN uses for comparin" the S(Ns $f the current incremental is a
differential backup at level n% then the parent is the most recent incremental of level n or less $f the current
incremental is a cumulative backup at level n% then the parent is the most recent incremental of level n/? or
less $f the S(N in the input data block is "reater than or e6ual to the checkpoint S(N of the parent% then
RMAN copies the block
Multile%el #ncremental Backups
RMAN can create multilevel incremental backups +ach incremental level is denoted b! an inte"er% for
e-ample% =% ?% <% and so forth A level = incremental backup% .hich is the base for subse6uent incremental
Author: Anup Kumar Srivastav
Topic: RMAN Basic
backups% copies all blocks containin" data The onl# difference bet$een a le"el % backup and a full
backup is that a full backup is ne"er included in an incremental strateg#
$f no level = backup e-ists .hen !ou run a level ? or hi"her backup% RMAN makes a level = backup
automaticall! to serve as the base
The benefit of performin" multilevel incremental backups is that RMAN does not back up all blocks all of
the time
Differential #ncremental Backups
$n a differential level n incremental backup% RMAN backs up all blocks that have chan"ed since the most
recent backup at level n or lo.er
1or e-ample% in a differential level < backups% RMAN determines .hich level < or level ? backup occurred
most recentl! and backs up all blocks modified after that backup $f no level ? is available% RMAN copies
all blocks chan"ed since the base level = backup $f no level = backup is available% RMAN makes a ne.
base level = backup for this file
Case &: if !ou .ant to implement incremental backup strate"! as a DBA in !our or"ani0ation:
se Command for incremental 'e%el Backup
RMAND backup incremental level = database ta">ES)NDA7E,
RMAND backup incremental level @ database ta">EMONDA7E,
RMAND backup incremental level @ database ta">ET)+SDA7E,
RMAND backup incremental level @ database ta">E'+DN+SDA7E,
RMAND backup incremental level < database ta">ET:)RSDA7E,
RMAND backup incremental level @ database ta">E1R$DA7E,
RMAND backup incremental level @ database ta">ESAT)RDA7E,
Backup ()ample * +ou can %iew your incremental Backup Details by usin! followin! ,uery-
select incremental9level% incremental9chan"eF% checkpoint9chan"eF% blocks from vGbackup9datafile,
Result of abo%e ,uery:
$N(92+8+2 $N(9(:AN5+F (:+(K*O$NT9(:AN5+F B2O(KS
= = <A?@BH H;H;H
@ <A?@BH <A?@B; <
@ <A?@B; <A?@A? ?
@ <A?@A? <A?@AC <
< <A?@BH <A?@AI <
@ <A?@AI <A?@I= ?
@ <A?@I= <A?@I@ <
Cumulati%e #ncremental Backups
RMAN provides an option to make cumulative incremental backups at level ? or "reater $n a cumulative
level n backup% RMAN backs up all the blocks used since the most recent backup at level n/? or lo.er
1or e-ample% in cumulative level < backups% RMAN determines .hich level ? backup occurred most
recentl! and copies all blocks chan"ed since that backup $f no level ? backups is available% RMAN copies
all blocks chan"ed since the base level = backup

Author: Anup Kumar Srivastav
Topic: RMAN Basic
(umulative incremental backups reduce the .ork needed for a restore b! ensurin" that !ou onl! need one
incremental backup from an! particular level (umulative backups re6uire more space and time than
differential backups% ho.ever% because the! duplicate the .ork done b! previous backups at the same level
Case &: if !ou .ant to implement (umulative backup strate"! as a DBA in !our or"ani0ation:
se Command for Cumulati%e 'e%el Backup
backup incremental level>= database ta">&base&,
backup incremental level>< cumulative database ta">&monda!&,
backup incremental level>< cumulative database ta">&tuesda!&,
backup incremental level>< cumulative database ta">&.ednesda!&,
backup incremental level>< cumulative database ta">&thursda!&,
backup incremental level>< cumulative database ta">&frida!&,
backup incremental level>< cumulative database ta">&saturda!&,
backup incremental level>? cumulative database ta">&.eekl!&,
#ncremental backup implementation
RMAN .ill determine the incremental S(N for each datafile 1ind the backup .ith hi"hest checkpoint scn
that belon"s to the incarnation of datafile matches the "iven fileF is an incremental backup#cop! at level N
or less if noncumulative or is an incremental backup#cop! at level N/? or less if cumulative belon"s to an
available backup set if backup
#ncremental Backup .trate!y
'e can implement a three/level backup scheme so that a full or level = backup is taken monthl!% a
cumulative level ? backup is taken .eekl!% and a cumulative level < is taken dail! $n this scheme% !ou
never have to appl! more than a da!&s .orth of redo for complete recover! 'hen decidin" ho. often to
take full or level = backups% a "ood rule of thumb is to take a ne. level = .henever H=J or more of the
data has chan"ed $f the rate of chan"e to !our database is predictable% then !ou can observe the si0e of
!our incremental backups to determine .hen a ne. level = is appropriate The follo.in" 6uer! displa!s the
number of blocks .ritten to a backup set for each datafile .ith at least H=J of its blocks backed up:
S+2+(T 1$2+F% $N(R+M+NTA292+8+2% (OM*2+T$ON9T$M+% B2O(KS% DATA1$2+9B2O(KS
1ROM 8GBA(K)*9DATA1$2+
':+R+ $N(R+M+NTA292+8+2 D = AND B2O(KS # DATA1$2+9B2O(KS D H
ORD+R B7 (OM*2+T$ON9T$M+,
(ompare the number of blocks in differential or cumulative backups to a base level = backup 1or e-ample%
if !ou onl! create level ? cumulative backups% then .hen the most recent level ? backup is about half of the
si0e of the base level = backup% take a ne. level =

You might also like