You are on page 1of 17

General RMAN Information :

What is RMAN and How to confgure it ?


Why to use RMAN ?
How RMAN works ?
What O/S and oracle user privilege reuired to use RMAN ?
RMAN ter!inology
"#What is RMAN and How to confgure it ?
A#RMAN is an Oracle $ata%ase client that per&or!s %ackup and recovery tasks on your data%ases and
auto!ates ad!inistration o& your %ackup strategies# 't greatly si!plifes the d%a (o%s %y !anaging the
production data%ase)s %acking up* restoring* and recovering data%ase fles#
+his tool integrates with sessions running on an Oracle data%ase to per&or! a range o& %ackup and
recovery activities* including !aintaining an RMAN repository o& historical data a%out %ackups# +here is no
additional installation reuired &or this tool# 'ts %y de&ault get installed with the oracle data%ase
installation# +he RMAN environ!ent consists o& the utilities and data%ases that play a role in %acking up
your data#,ou can access RMAN through the co!!and line or through Oracle -nterprise Manager#
"#Why to use RMAN ?
A#RMAN gives you access to several %ackup and recovery techniues and &eatures not availa%le with user.
!anaged %ackup and recovery# +he !ost noteworthy are the &ollowing/
-- Automatic specifcation of fles to include in a backup : -sta%lishes the na!e and locations o& all
fles to %e %acked up#
-- Maintain backup repository : 0ackups are recorded in the control fle* which is the !ain repository o&
RMAN !etadata# Additionally* you can store this !etadata in a recovery catalog*
-- Incremental backups : An incre!ental %ackup stores only %locks changed since a previous %ackup#
+hus* they provide !ore co!pact %ackups and &aster recovery* there%y reducing the need to apply redo
during datafle !edia recovery#
-- Unused block compression : 'n unused %lock co!pression* RMAN can skip data %locks that have
never %een used
-- Block media recovery : ,ou an repair a datafle with only a s!all nu!%er o& corrupt data %locks
without taking it o1ine or restoring it &ro! %ackup#
-- Binary compression : A %inary co!pression !echanis! integrated into Oracle $ata%ase reduces the
si2e o& %ackups#
-- Encrypted backups : RMAN uses %ackup encryption capa%ilities integrated into Oracle $ata%ase to
store %ackup sets in an encrypted &or!at#
-- Corrupt block detection : RMAN checks &or the %lock corruption %e&ore taking its %ackup#

"#How RMAN works ?
A#RMAN %ackup and recovery operation &or a target data%ase are !anaged %y RMAN client# RMAN uses the
target data%ase control fle to gather !etadata a%out the target data%ase and to store in&or!ation a%out
its own operations# +he RMAN client itsel& does not per&or! %ackup* restore* or recovery operations# When
you connect the RMAN client to a target data%ase* RMAN allocates server sessions on the target instance
3
and directs the! to per&or! the operations#+he work o& %ackup and recovery is per&or!ed %y server
sessions running on the target data%ase# A channel esta%lishes a connection &ro! the RMAN client to a
target or au4iliary data%ase instance %y starting a server session on the instance#+he channel reads data
into !e!ory* processes it* and writes it to the output device#
When you take a data%ase %ackup using RMAN* you need to connect to the target data%ase using RMAN
5lient#+he RMAN client can use Oracle Net to connect to a target data%ase* so it can %e located on any
host that is connected to the target host through Oracle Net# 6or %ackup you need to allocate e4plicit or
i!plicit channel to the target data%ase# An RMAN channel represents one strea! o& data to a device* and
corresponds to one data%ase server session# +his session dyna!ically collect in&or!ation o& the fles &ro!
the target data%ase control fle %e&ore taking the %ackup or while restoring#
6or e4a!ple '& you give ) 0ackup data%ase ) &ro! RMAN* it will frst get all the datafles in&or!ation &ro!
the controlfle# +hen it will divide all the datafles a!ong the allocated channels# 7 roughly eual si2e o&
work as per the datafle si2e 8# +hen it takes the %ackup in 9 steps# 'n the frst step the channel will read all
the 0locks o& the entire datafle to fnd out all the &or!atted %locks to %ackup# Note / RMAN do not take
%ackup o& the un &or!atted %locks# 'n the second step it take %ackup o& the &or!atted %locks# +his is the
%est advantage o& using RMAN as it only take %ackup o& the reuired %locks# :ets say in a datafle o& 3;;
M0 si2e* there !ay %e only 3; M0 o& use &ull data and rest <; M0 is &ree then RMAN will only take %ackup
o& those 3; M0#
"#What O/S and oracle user privilege reuired to use RMAN ?
A#RMAN always connect to the target or au4iliary data%ase using the S,S$0A privilege# 'n &act the S,S$0A
keywords are i!plied and cannot %e e4plicitly specifed# 'ts connections to a data%ase are specifed and
authenticated in the sa!e way as S":=>lus connections to a data%ase#
+he O/S user should %e part o& the $0A group # 6or re!ote connection it needs the password fle
Authentication#+arget data%ase should have the initiali2ation para!eter
R-MO+-?:O@'N?>ASSWOR$6':- set to -A5:BS'C- or SHAR-$#
"#RMAN ter!inology /
A target database : An Oracle data%ase to which RMAN is connected with the +AR@-+ keyword# A target
data%ase is a data%ase on which RMAN is per&or!ing %ackup and recovery operations# RMAN always
!aintains !etadata a%out its operations on a data%ase in the control fle o& the data%ase#
A recovery Catalog : A separate data%ase sche!a used to record RMAN activity against one or !ore
target data%ases# A recovery catalog preserves RMAN repository !etadata i& the control fle is lost* !aking
it !uch easier to restore and recover &ollowing the loss o& the control fle# +he data%ase !ay overwrite
older records in the control fle* %ut RMAN !aintains records &orever in the catalog unless deleted %y the
user#
Backup sets : RMAN can store %ackup data in a logical structure called a %ackup set* which is the
s!allest unit o& an RMAN %ackup# One %ackup set contains one or !ore datafles a section o& datafle or
archivelogs#
Backup Piece : A %ackup set contains one or !ore %inary fles in an RMAN.specifc &or!at# +his fle is
known as a %ackup piece# -ach %ackup piece is a single output fle# +he si2e o& a %ackup piece can %e
restrictedD i& the si2e is not restricted* the %ackup set will co!prise one %ackup piece# 0ackup piece si2e
should %e restricted to no larger than the !a4i!u! fle si2e that your flesyste! will support#
Image copies : An i!age copy is a copy o& a single fle 7datafle* archivelog* or controlfle8# 't is very
si!ilar to an O/S copy o& the fle# 't is not a %ackupset or a %ackup piece# No co!pression is per&or!ed#
Snapshot Controlfle : When RMAN needs to resynchroni2e &ro! a read.consistent version o& the control
fle* it creates a te!porary snapshot control fle# +he de&ault na!e &or the snapshot control fle is port.
specifc#
9
Database Incarnation : Whenever you per&or! inco!plete recovery or per&or! recovery using a %ackup
control fle* you !ust reset the online redo logs when you open the data%ase# +he new version o& the reset
data%ase is called a new incarnation# +he reset data%ase co!!and directs RMAN to create a new data%ase
incarnation record in the recovery catalog# +his new incarnation record indicates the current incarnation#
RMAN Configuration :
What is RMAN 5onfguration and how to 5onfgure it ?
How to check RMAN 5onfguration ?
How to Reset the de&ault 5onfguration ?
"#What is RMAN 5onfguration and how to 5onfgure it ?
A#+he RMAN %ackup and recovery environ!ent is preconfgured &or each target data%ase# +he
confguration is persistent and applies to all su%seuent operations on this target data%ase* even i& you
e4it and restart RMAN# RMAN confgured settings can speci&y %ackup devices* confgure a connection to a
%ackup device * policies aEecting %ackup strategy* encryption algorith!* snap shot controlfle loaion and
others#
0y de&ault there are &ew de&ault confguration are set when you login to RMAN# ,ou can custo!i2e the! as
per your reuire!ent# Any ti!e you can check the current setting %y using the FShow all F co!!and#
5ON6'@BR- co!!and is used to create persistent settings in the RMAN environ!ent* which apply to all
su%seuent operations* even i& you e4it and restart RMAN#6or details o& the 5onfguration kindly re&er Note
GH
"#How to check RMAN 5onfguration ?
RMAN>Show all;

"#How to Reset to de&ault 5onfguration ?
A#+o reset the de&ault confguration setting use
Connect to the target database from sqlplus and run
SQL> connect <ss!passwd as ssdba>"target#database;
SQL> e$ecute dbms#bac%up#restore&resetConf'g;
RMAN Catalog Database
What is 5atalog data%ase and How to 5onfgure it ?
How Many catalog data%ase ' can have ?
's this !andetory to use catalog data%ase ?
What is the advantage o& catalog data%ase ?
What is the diEerence %etween catalog data%ase and catalog sche!a ?
5atalog data%ase co!pati%ility !atri4 with the target data%ase ?
What happen i& catalog data%ase lost ?
"# What is 5atalog data%ase and How to 5onfgure it ?
A# +his is a separate data%ase which contains catalog sche!a# ,ou can use the sa!e target data%ase as
I
the catalog data%ase %ut its not at all reco!!ended# 6or !ore details on Recovery catalog kindly re&er
the Note JK9K9<#3/ Recovery catalog &or RMAN %ackup
"# How Many catalog data%ase ' can have ?
A# ,ou can have !ultiple catalog data%ase &or the sa!e target data%ase # 0ut at a ti!e you can connect to
only 3 catalog data%ase via RMAN# 'ts not reco!!ended to have !ultiple catalog data%ase#
"# 's this !andatory to use catalog data%ase ?
A# No L its a optional one#
"# What is the advantage o& catalog data%ase ?
A# 5atalog data%ase is a secondary storage o& %ackup !etadata# 'ts very use&ul in case you lost the
current controlfle* as all the %ackup in&or!ation are there in the catalog sche!a# Secondly &ro! contolfle
the older %ackup in&or!ation are aged out depending upon the control?fle?record?keep?ti!e# RMAN
catalog data%ase !ainten the history o& data# Mindly re&er the note GH &or !ore details on relation
%etween retention policy and control?6ile?record?keep?ti!e#
"# What is the diEerence %etween catalog data%ase N catalog sche!a ?
A# 5atalog data%ase is like any other data%ase which contains the RMAN catalog user)s sche!a#
"# 5atalog data%ase co!pati%ility !atri4 with the target data%ase ?
A# re&er Note OIJI3#3 / RMAN 5o!pati%ility Matri4
"# What happen i& catalog data%ase lost ?
A# Since catalog data%ase is a option one there is no direct eEect o& loss o& catalog data%ase# 5reate a
new catalog data%ase and register the target data%ase with the newly createdcatalog one# All the %ackup
in&or!ation &ro! the target data%ase current controlfle will %e updated to the catalog sche!a# '& any
%ackup in&or!ation which is aged out &ro! the target data%ase then you need to !anually catalog those
%ackup pieces#
RMAN backup :
What are the data%ase fles that RMAN can %ackup ?
What are the data%ase fles that RMAN can not %ackup ?
5an ' have archivelogs and datafle %ackup in a single %ackupset ?
5an ' have datafles and contolfle %ackup in a single %ackup set?
5an ' regulate the si2e o& %ackup piece and %ackupset ?
What is the diEerence %etween %ackup set %ackup and '!age copy %ackup ?
What is RMAN consistent %ackup and 'nconsistent %ackup ?
5an ' take RMAN %ackup when the data%ase is $own ?
$o ' need to place the data%ase in %egin %ackup !ode while taking RMAN inconsistent %ackup ?
5an ' co!press RMAN %ackups ?
5an ' encrypt RMAN %ackup ?
"# What are the data%ase fle)s that RMAN can %ackup ?
A# RMAN can %ackup 5ontrolfle * $atafles * Archive logs * stand%y data%ase controfle* Spfle
"# What are the data%ase fle)s that RMAN can not %ackup ?
A# RMAN can not take %ackup o& the pfle* Redo logs * network confguration fles* password fles* e4ternal
ta%les and the contents o& the Oracle ho!e fles
"# 5an ' have archivelogs and datafle %ackup in a single %ackupset ?
A# No # we can not put datafles and archive logs in the sa!e %ackupset#
"# 5an ' have datafles and contolfle %ackup in a single %ackup set ?
A# ,es # '& the controlfle auto%ackup is not ON then RMAN takes %ackup o& controlfle along with the
J
datafle 3* whenever you take %ackup o& the data%ase or Syste! ta%lespace# Mindly re&er 7 === create a
note &or controfle auto %ackup 8
"# 5an ' regulate the si2e o& %ackup piece and %ackupset ?
A# ,es L ,ou can set !a4 si2e o& the %ackupset as well as the %ackup piece# 0y de&ault one RMAN channel
creates a single %ackupset with one %ackup piece in it# ,ou can use the MAA>'-5-S'P- channel para!eter
to set li!its on the si2e o& %ackup pieces# ,ou can also use the MAAS-+S'P- para!eter on the 0A5MB> and
5ON6'@BR- co!!ands to set a
li!it &or the si2e o& %ackup sets#
"# What is the diEerence %etween %ackup set %ackup and '!age copy %ackup ?
A / A %ackup set is an RMAN.specifc proprietary &or!at* whereas an i!age copy is a %it.&or.%it copy o& a
fle# 0y de&ault*RMAN creates %ackup sets
"# What is RMAN consistent %ackup and inconsistent %ackup ?
A# A consistent %ackup occurs when the data%ase is in a consistent state# +hat !eans %ackup o& the
data%ase taken a&ter a shutdown i!!ediate * shutdown nor!al or shutdown transactional# '& the data%ase
is shutdown with a%ort option then its not a consistent %ackup#
A %ackup when when the data%ase is Bp and running is called an inconsistent %ackup# When a data%ase is
restored &ro! an inconsistent %ackup* Oracle !ust per&or! !edia recovery %e&ore the data%ase can %e
opened* applying any pending changes &ro! the redo logs# ,ou can not take inconsistent %ackup when the
data%ase is in NoArchivelog !ode#
"# 5an ' take RMAN %ackup when the data%ase is $own ?
A# No L ,ou can take RMAN %ackup only when the target data%ase is Open or in Mount stage# 'ts %ecause
RMAN keep the %ackup !etadata in controfle # Only in open or !ount !ode controlfle is accessi%le#
"# $o ' need to place the data%ase in %egin %ackup !ode while taking RMAN inconsistent %ackup ?
A# RMAN does not reuire e4tra logging or %ackup !ode %ecause it knows the &or!at o& data %locks# RMAN
is guaranteed not to %ack up &ractured %locks#No e4tra redo is generated during RMAN %ackup#
"# 5an ' co!press RMAN %ackups ?
A# RMAN supports %inary co!pression o& %ackup sets# +he supported algorith!s are 0P'>9 7de&ault8 and
P:'0# Mindly re&er Note KQIJ9O#3 &or !ore details a%out diEerent type o& co!pressions# 'ts not reco!!end
to co!press the RMAN %ackup using any other OS or third party utility#
Note / RMAN co!pressed %ackup with 0P'>9 provides great co!pression %ut is 5>B intensive# Bsing P:'0
co!pression reuires the Oracle $ata%ase 33g Advanced 5o!pression Option and is only supported with
an 33g data%ase# +he &eature is not %ackward co!pati%le with 3;g data%ases#
"# 5an ' encrypt RMAN %ackup ?
A# RMAN supports %ackup encryption &or %ackup sets# ,ou can use wallet.%ased transparent encryption*
password.%ased encryption* or %oth# ,ou can use the 5ON6'@BR- -N5R,>+'ON co!!and to confgure
persistent transparent encryption# Bse the S-+ -N5R,>+'ON* co!!and at the RMAN session level to
speci&y password.%ased encryption#
8!" #o$ to speci%y backup destination &
9. Can RMAN take backup to Tape ?
,es L you can use RMAN &or the tape %ackup# 0ut RMAN can not a%le to write directly to tape# ,ou need to
have third party Media Manage!ent So&tware installed# Oracle has pu%lished an A>' specifcation which
Media Manage!ent Cendor)s who are !e!%ers o& Oracle)s 0ackup Solutions >artner progra! have access
to# Media Manage!ent Cendors 7MMCs8 then write an inter&ace li%rary which the Oracle server uses to
write and read to
and &ro! tape#
K
'! (here can I get the list o% supported )hird party *edia *anagement So%t$are %or tape
backup &
RMAN should not %e used with that Media Manager until the MMC has certifed that their so&tware works
with
RMan# -ither contact your Media Manager* or check the RMan ho!e page &or updates on which MMCs have
certifed their products on which plat&or!s/
http///www#oracle#co!/technology/deploy/availa%ility/htdocs/%sp#ht!
Starting &ro! oracle 3;g R9 oracle has its Own Media !anage!ent so&tware &or the data%ase %ackup to
tape called OS0#
<#9 How RMAN 'nteract with Media !anager ?
0e&ore per&or!ing %ackup or restore to a !edia !anager* you !ust allocate one or !ore channels or
confgure de&ault channels &or use with the !edia !anager to handle the co!!unication with the !edia
!anager# RMAN does not issue specifc co!!ands to load* la%el* or unload tapes# When %acking up* RMAN
gives the !edia !anager a strea! o& %ytes and associates a uniue na!e with this strea!# When RMAN
needs to restore the %ackup* it asks the !edia !anager to retrieve the %yte strea!# All details o& how and
where that strea! is stored are handled entirely %y the !edia !anager#
<#I What is >ro4y copy %ackup to tape ?
>ro4y copy is &unctionality* supported %y &ew !edia !anager in which they handle the entire data
!ove!ent %etween datafles and the %ackup devices# Such products !ay use technologies such as high.
speed connections %etween storage and !edia su%syste!s to reduce load on the pri!ary data%ase server#
RMAN provides a list o& fles reuiring %ackup or restore to the !edia !anager* which in turn !akes all
decisions regarding how and when to !ove the data#
<#J What is Oracle Secure %ackup ?
Oracle Secure 0ackup is a !edia !anager provided %y oracle that provides relia%le and secure data
protection through fle syste! %ackup to tape# All !a(or tape drives and tape li%raries in SAN* @iga%it
-thernet* and S5S' environ!ents are supported#
Q
!er!ie" of t#e RMAN $n!ironment
'nstalled with the data%ase* Recovery Manager 7RMAN8 is an Oracle data%ase client which per&or!s %ackup
and recovery tasks on your data%ases and auto!ates ad!inistration o& your %ackup strategies# 't greatly
si!plifes %acking up* restoring* and recovering the data%ase#
+he RMAN environ!ent consists o& the utilities and data%ases that play a role in %acking up your data# At a
!ini!u!* the environ!ent &or RMAN !ust include the &ollowing/
+he target data%ase# +his is the data%ase to %e %acked up %y RMAN#
+he RMAN client is a co!!and.line.oriented data%ase client* !uch like S":=>lus* with its own
co!!and synta4# 6ro! the RMAN client you can issue RMAN co!!ands and so!e S": state!ents
to per&or! and report on %ackup and recovery operations#
So!e environ!ents will also use these optional co!ponents/
A Rash recovery area/ a disk location in which the data%ase can store and !anage fles related to
%ackup and recovery#
Media !anage!ent so&tware/ so&tware provided %y !edia !anager vendors which is reuired &or
RMAN to inter&ace with %ackup devices such as tape drives#
A recovery catalog data%ase/ a separate data%ase sche!a used to record RMAN activity against
one or !ore target data%ases#
Deci%ing &#et#er to 'se a (las# Reco!er) Area *(RA+
't is reco!!ended that you take advantage o& the 6RA to store as !any %ackup and recovery.related fles
as as possi%le* including disk %ackups and archived redo logs#
So!e &eatures o& Oracle data%ase %ackup and recovery* such as Oracle 6lash%ack $ata%ase and
guaranteed restore points* reuire the use o& an 6RA# However* having an 6RA &or use %y these &eatures
does not &orce you to use it to store all recovery.related fles#
-ven when its use is not reuired* however* the 6RA oEers a nu!%er o& advantages over other on.disk
%ackup storage !ethods# 0ackups !oved to tape &ro! the Rash recovery area 7via RMAN and !edia
!anager8 are retained on disk until space is needed &or other reuired fles* reducing the need to restore
%ackups &ro! tape# At the sa!e ti!e* o%solete fles no longer needed to !eet your recovera%ility goals
and fles %acked up to tape %eco!e eligi%le &or deletion and are deleted when space is needed# +hese
deletions are !anaged %y Oracle when space is reuired# +he $0A no longer has to !anually delete old
%ackups* and* it is less likely that a $0A accidentally deletes redundancy set fles# Note that i& %ackups
written to the 6RA are not copied via RMAN and !edia !anager to tape* the auto!atic deletion o& o%solete
%ackups does not occur and pre.Oracle3;g cleanup !ethods are reuired#
Mnowledge%ase Article Re&erence/
Note/I;KS3O#3 6A" . 6lash Recovery Area &eature o& 3;@
Deci%ing &#et#er to use a Reco!er) Catalog
RMAN !aintains !etadata a%out the target data%ase and its %ackup and recovery operations in the RMAN
repository# A!ong other things* RMAN stores in&or!ation a%out its own confguration settings* the target
data%ase sche!a* archived redo logs* and all %ackup fles on disk or tape# RMAN)s :'S+* R->OR+* and
O
SHOW co!!ands display RMAN repository in&or!ation#
+he pri!ary store &or RMAN repository data is always the control fle o& the target data%ase# +he
5ON+RO:?6':-?R-5OR$?M-->?+'M- initiali2ation para!eter controls how long %ackup records are kept in
the control fle %e&ore those records are re.used to hold in&or!ation a%out !ore recent %ackups#
Another copy o& the RMAN repository data can also %e saved in the recovery catalog#
Bsing a recovery catalog preserves RMAN repository in&or!ation i& the control fle is lost* !aking it !uch
easier to restore and recover &ollowing the loss o& the control fle# 7A %ackup control fle !ay not contain
co!plete in&or!ation a%out recent availa%le %ackups#8 +he recovery catalog can also store a !uch !ore
e4tensive history o& your %ackups than the control fle* due to li!its on the nu!%er o& control fle records#
'n addition to RMAN repository records* the recovery catalog can also hold RMAN stored scripts* seuences
o& RMAN co!!ands &or co!!on %ackup tasks# 5entrali2ed storage o& scripts in recovery catalog can %e
!ore convenient than working with co!!and fles#
-4cept &or stored scripts* all o& RMAN)s &eatures work eually well with or without a recovery catalog#
Oracle3;g $ocu!entation Re&erences/
Oracle $ata%ase 0ackup and Recovery Advanced Bser)s @uide @uide . !ore in&or!ation a%out the
recovery catalog
Oracle $ata%ase 0ackup and Recovery Re&erence . 5R-A+- 5A+A:O@ co!!and synta4

,tarting an% $-iting RMAN
+he RMAN client is started %y issuing the r!an co!!and at the co!!and pro!pt o& your operating
syste!#
RMAN !ust connect to a target data%ase 7with S,S$0A privileges8 to per&or! %ackup and recovery tasks#
RMAN can also connect to a recovery catalog data%ase i& you are using one# Speci&y target and recovery
catalog data%ases using co!!and line options or using the 5ONN-5+ co!!and#
+his co!!and illustrates connecting RMAN to a target data%ase and a recovery catalog at startup/
( rman )AR*+) ! CA)AL,* cat#usr!pwd"cat#str
5onnect to a target data%ase without using a recovery catalog/
( rman )AR*+) S-S!pwd"target#str
Starting RMAN without connecting to a data%ase/
( rman
Once started* RMAN displays an FRMANHF pro!pt &or your co!!ands#

S

Configuring .ersistent ,ettings for t#e RMAN $n!ironment
,ou can use the RMAN 5ON6'@BR- co!!and to create persistent settings in the RMAN environ!ent* which
apply to all su%seuent operations* even i& you e4it and restart RMAN# +hese confgured settings can
speci&y disk and S0+ channel %ehavior* %ackup destinations* policies aEecting %ackup strategy* and others#
+his co!!and shows all confgura%le settings/
RMAN> S.,/ ALL;
Mnowledge%ase Article/
Note I;KKQK#3 >ersistent 5ontrolfle 5onfgurations &or RMAN in <i and 3;g
Oracle3;g $ocu!entation Re&erence
Oracle $ata%ase 0ackup and Recovery 0asics . !ore in&or!ation a%out confguration settings#

/acking up t#e Controlfile an% ,pfile
+he control fle can %e auto!atically %acked up a&ter each RMAN %ackup and data%ase structure change as
a way to protect the RMAN repository# '& an spfle is %eing used* it is also %acked up# When using RMAN
without a recovery catalog* it is reco!!ended that the controlfle auto%ackup %e set to ON# +he &ollowing
co!!and confgures RMAN to create these control fle auto%ackups/
RMAN> C,N01*2R+ C,N)R,L01L+ A2),3AC425 ,N;
0y de&ault* RMAN auto!atically generates na!es &or control fle auto%ackups and stores the! in the 6RA i&
defned# +he &ollowing co!!and confgures RMAN to write control fle auto%ackups to the /!y%ackupdir
directory/

RMAN> C,N01*2R+ C,N)R,L01L+ A2),3AC425 0,RMA)
0,R 6+71C+ )-5+ 61S4 ), 8!mbac%upd'r!cf(08;
+he T6 ele!ent o& the &or!at string co!%ines the $0'$* day* !onth* year* and seuence nu!%er to
generate a uniue flena!e# T6 !ust %e included in any control fle auto%ackup &or!at#

,ou can %ack up the control fle when the data%ase is !ounted or open# RMAN uses a snapshot control fle
to ensure a read.consistent version# '& 5ON6'@BR- 5ON+RO:6':- AB+O0A5MB> is ON 7%y de&ault it is O668*
then RMAN auto!atically %acks up the control fle and server para!eter fle a&ter every %ackup and a&ter
data%ase structural changes# +he controlfle auto%ackup contains !etadata a%out the previous %ackup*
which is crucial &or disaster recovery# 5onfguring controlfle auto%ackup on is reco!!ended and is the
only way RMAN can restore a controlfle %ackup i& all controlfles are lost and there is no recovery catalog in
use#
<
'& the auto%ackup &eature is not set* then you !ust !anually %ack up the control fle in one o& the &ollowing
ways/
Run 0A5MB> 5BRR-N+ 5ON+RO:6':-
'nclude a %ackup o& the control fle within any %ackup %y using the 'N5:B$- 5BRR-N+
5ON+RO:6':- option o& the 0A5MB> co!!and
0ack up datafle 3* %ecause RMAN auto!atically includes the control fle and S>6':- in %ackups o&
datafle 3 when the controlfle auto%ackup is set to O66#
A !anual %ackup o& the control fle is not the sa!e as a control fle auto%ackup# 'n !anual %ackups* only
RMAN repository data &or %ackups within the current RMAN session is in the control fle %ackup* and a
!anually %acked.up control fle cannot %e auto!atically restored#
Oracle3;g $ocu!entation Re&erence/
Oracle $ata%ase 0ackup and Recovery Advanced Bser)s @uide . !ore in&or!ation a%out control fle
auto%ackups

/acking up Database (iles
Bse the RMAN 0A5MB> co!!and to %ack up fles# ,ou can confgure de&ault devices and channels in
advance# +he 0A5MB> co!!and %acks up your data to the confgured de&ault device and channels &or the
type o& %ackup reuested#
'& you speci&y 0A5MB> AS 5O>,* then RMAN copies the fles as i!age copies* %it.&or.%it copies o& data%ase
fles created on disk# +hese are identical to copies o& the sa!e fles that you can create with operating
syste! co!!ands like cp on Bni4 or 5O>, on Windows# However* using 0A5MB> AS 5O>, will %e recorded
in the RMAN repository and RMAN can use the! in restore operations# '!age copies cannot %e created on
tape#
+his co!!and creates i!age copy %ackups o& all datafles in the data%ase/
RMAN> 3AC425 AS C,5- 6A)A3AS+;

'& you speci&y 0A5MB> AS 0A5MB>S-+* then RMAN stores its %ackups in %ackup sets# A %ackup set*
consisting o& one or !ore %ackup pieces* contains the physical fle data %eing %acked up# +his %ackupset
is written in a &or!at that only RMAN can access# Only RMAN can create and restore %ackup sets# 0ackup
sets can %e written to disk or tape* and they are the only type o& %ackup which RMAN can use to write
%ackups to tape#
+he &ollowing co!!and creates a %ackup o& the data%ase and archived logs on tape* in %ackup set &or!at*
using the confgured channels/

RMAN> 3AC425 6+71C+ )-5+ sbt 6A)A3AS+ 5L2S ARC.17+L,*;

3;
Note/
0acking up datafles as %ackup sets on disk can save disk space and ti!e %ecause RMAN will skip %acking
up so!e unused datafle %locks# 0ackup sets* once written on disk* can %e !oved to tape with the 0A5MB>
0A5MB>S-+ co!!and# See the description o& unused %lock co!pression in Oracle $ata%ase 0ackup and
Recovery Re&erence &or details#
0acking Bp 'ndividual 6iles
,ou can %ack up individual ta%lespaces* datafles and control fles* server para!eter fles* and %ackup sets
with various options* as in these e4a!ples/
RMAN> 3AC425 ARC.17+L,* from t'me 8ssdate9:8;
RMAN> 3AC425 )A3L+S5AC+ sstem; users; tools;
RMAN> 3AC425 AS 3AC425S+) 6A)A01L+
8,RACL+#.,M+!oradata!trgt!users<=&dbf8;
8,RACL+#.,M+!oradata!trg!tools<=&dbf8;
RMAN> 3AC425 6A)A01L+ =;>;?;
RMAN> 3AC425 C2RR+N) C,N)R,L01L+ ), 8!bac%up!curr#cf&cop8;
RMAN> 3AC425 S501L+;
RMAN> 3AC425 3AC425S+) ALL;
0ackup Options
Here are so!e o&ten.used 0A5MB> co!!and options/
>ara!eter -4a!ple -4planation
6ORMA+ 6ORMA+)/t!p/TB) Specifes a location and na!e &or %ackup pieces and
copies# ,ou !ust use su%stitution varia%les to generate uniue flena!es#
>ara!eter -4a!ple -4planation
+A@ +A@ )!onday?%ak) Specifes a user.defned string as a la%el &or the %ackup# '&
you do not speci&y a tag* then RMAN assigns a de&ault tag with the date and ti!e#
+he &ollowing 0A5MB> co!!ands illustrate these options/
RMAN> 3AC425 0,RMA)@8AL#(d!(t!(s!(p8 ARC.17+L,* L14+ 8(arc#dest(8;
RMAN> 3AC425 )A* 8wee%l#full#db#b%up8 6A)A3AS+ MAAS+)S1B+ =<M;
RMAN> 3AC425 C,51+S : 6+71C+ )-5+ sbt 3AC425S+) ALL;
'ncre!ental 0ackups /
'& you speci&y 0A5MB> 'N5R-M-N+A:* RMAN will create incre!ental %ackups o& your data%ase# 'ncre!ental
%ackups capture on a %lock.%y.%lock %asis changes in your data%ase since a previous incre!ental %ackup#
+he starting point &or an incre!ental %ackup strategy is a level ; incre!ental %ackup* which %acks up all
%locks in the data%ase# :evel 3 incre!ental %ackups* taken at regular intervals* contain only changed
33
%locks since a previous incre!ental %ackup# +hese can %e cu!ulative 7including all %locks changed since
the !ost recent level ; %ackup8 or diEerential 7including only %locks changed since the !ost recent
incre!ental %ackup* whether it is level ; or level 38#
'ncre!ental %ackups are generally s!aller and &aster to create than &ull data%ase %ackups# Recovery &ro!
an incre!ental %ackup is &aster than recovery using redo logs alone# $uring a restore &ro! incre!ental
%ackup* the level ; %ackup is used as the starting point* then changed %locks are updated %ased on level 3
%ackups where possi%le to avoid re.applying changes &ro! redo one at a ti!e# Recovering with incre!ental
%ackups reuires no additional eEort on your part# '& incre!ental %ackups are availa%le* RMAN will use
the! during recovery#
-nterprise -dition includes RMAN)s change tracking &eature &or incre!ental %ackups which i!proves
incre!ental %ackup per&or!ance %y recording changed %locks in each datafle in a change tracking fle# '&
change tracking is ena%led* RMAN uses the change tracking fle to identi&y changed %locks &or incre!ental
%ackup* thus avoiding the need to scan every %lock in the datafle#
Mnowledge%ase Article Re&erence/
Note 9Q9SKI#3 3;@ RMAN 6ast 'ncre!ental 0ackups
'ncre!entally Bpdated 0ackups/
RMAN)s incre!entally updated %ackups &eature allows &or a !ore eUcient incre!ental %ackup routine#
5hanges &ro! level 3 %ackups can %e used to roll &orward an i!age copy level ; incre!ental %ackup* so
that it includes all changes as o& the S5N at which the level 3 incre!ental %ackup was created# Recovery
using the updated level ; incre!ental %ackup is &aster* %ecause all changes &ro! the level 3 incre!ental
%ackup have already %een applied#
Oracle3;g $ocu!entation Re&erences/
Oracle $ata%ase 0ackup and Recovery 0asics . !ore details and e4a!ples &or incre!ental %ackups and
incre!entally updated %ackups#
Oracle $ata%ase 0ackup and Recovery Re&erence . co!plete 0A5MB> co!!and synta4#

/acking 'p Arc#i!e% Re%o 0ogs
Archived redo logs are the key to success&ul !edia recovery# 0ack the! up regularly# ,ou can %ack up logs
with 0A5MB> AR5H'C-:O@* or %ack up logs while %acking up datafles and control fles %y speci&ying
0A5MB> ### >:BS AR5H'C-:O@#
+o %ack up archived redo logs* use the 0A5MB> AR5H'C-:O@ co!!and at the RMAN pro!pt# +his e4a!ple
uses a confgured disk or s%t channel to %ack up one copy o& each log seuence nu!%er &or all archived
redo logs/

RMAN> 3AC425 ARC.17+L,* ALL;
-ven i& your redo logs are %eing archived to !ultiple destinations and you use RMAN to %ack up archived
redo logs* RMAN selects only one copy o& the archived redo log fle to include in the %ackup set# 7Since logs
with the sa!e log seuence nu!%er are identical* there is no need to include !ore than one copy#8
39
,ou can also speci&y a range o& archived redo logs %y ti!e* S5N* or log seuence nu!%er* as in the
&ollowing e4a!ple/

RMAN> 3AC425 ARC.17+L,*
0R,M )1M+ 8S-S6A)+9><8 2N)1L )1M+ 8S-S6A)+9C8;
,ou can speci&y the $-:-+- 'N>B+ or $-:-+- A:: 'N>B+ clauses &or the 0A5MB> AR5H'C-:O@ co!!and to
delete archived logs a&ter they are %acked up* eli!inating the separate step o& !anually deleting the
archived redo logs# With $-:-+- 'N>B+* RMAN only deletes the specifc copy o& the archived redo log
chosen &or the %ackup set# With $-:-+- A:: 'N>B+* RMAN will delete each %acked.up archived redo log fle
&ro! all log archiving destinations#
Oracle3;g $ocu!entation Re&erences/
Oracle $ata%ase 0ackup and Recovery 0asics . !ore details regarding archived log %ackups

Oracle $ata%ase 0ackup and Recovery Re&erence . co!plete 0A5MB> and archivelogRecordSpecifer
co!!and synta4

Restoring an% Reco!ering Database (iles
Bse the R-S+OR- and R-5OC-R co!!ands &or RMAN restore and recovery o& physical data%ase fles#
Restoring datafles is retrieving the! &ro! %ackups as needed &or a recovery operation# Recovery is the
application o& changes &ro! redo logs and incre!ental %ackups to a restored datafle* to %ring the datafle
to a desired S5N 7point in ti!e8 or to current ti!e#
Recovering the Whole $ata%ase /
Bse the R-S+OR- $A+A0AS- and R-5OC-R $A+A0AS- co!!ands on the whole data%ase# 6or e4a!ple/
RMAN> S)AR)25 0,RC+ M,2N);
R+S),R+ 6A)A3AS+;
R+C,7+R 6A)A3AS+;
AL)+R 6A)A3AS+ ,5+N;
Note that the data%ase !ust not %e open when restoring or recovering the entire data%ase#
Recovering 5urrent +a%lespaces /
Bse the R-S+OR- +A0:-S>A5- and R-5OC-R +A0:-S>A5- co!!ands on individual ta%lespaces when the
data%ase is open# +ake the ta%lespace that needs recovery o1ine* restore and then recover the
ta%lespace* and %ring the recovered ta%lespace online# +he &ollowing steps recover the users ta%lespace/
RMAN> SQL 8AL)+R )A3L+S5AC+ users ,00L1N+8;
R+S),R+ )A3L+S5AC+ users;
R+C,7+R )A3L+S5AC+ users;
SQL 8AL)+R )A3L+S5AC+ users ,NL1N+;
Recovering 5urrent $atafles /
Bse the R-S+OR- $A+A6':- and R-5OC-R $A+A6':- co!!ands on individual current datafles when the
3I
data%ase open# +ake the datafle that needs recovery o1ine* restored recover the datafle* and %ring the
datafle online# 6or e4a!ple* to restore and recover datafle O/
RMAN> SQL 8AL)+R 6A)A3AS+ 6A)A01L+ C ,00L1N+8;
R+S),R+ 6A)A01L+ C;
R+C,7+R 6A)A01L+ C;
SQL 8AL)+R 6A)A3AS+ 6A)A01L+ C ,NL1N+8;
Recovering 'ndividual $ata 0locks /
RMAN can recover individual corrupted datafle %locks# When RMAN per&or!s a co!plete scan o& a fle &or
a %ackup* any corrupted %locks are listed in CV$A+A0AS-?0:O5M?5ORRB>+'ON# 5orruption is usually
reported in alert logs* trace fles or results o& S": ueries# Bse 0:O5MR-5OC-R to repair all corrupted
%locks/

RMAN> 3L,C4R+C,7+R C,RR25)1,N L1S);
,ou can also recover individual %locks* as shown in this e4a!ple/

RMAN> 3L,C4R+C,7+R 6A)A01L+ C 3L,C4 :>>; :>? 6A)A01L+ D 3L,C4 =<=;
Oracle3;g $ocu!entation Re&erences/
Oracle $ata%ase 0ackup and Recovery 0asics . !ore details regarding restore and recovery operations
Oracle $ata%ase 0ackup and Recovery Re&erence . co!plete R-S+OR-Dand R-5OC-R co!!and synta4
NO+-/ Only an entire data%ase can %e recovered to a point in ti!e* there is a separate procedure &or
recovering a ta%lespace to a point in ti!e#
,racle 6atabase 3ac%up and RecoEer AdEanced 2ser8s *u'de 9 'nformat'on on RMAN )ablespace
5o'nt9'n9)'me RecoEer F)S51)RG

Reporting on RMAN perations
+he RMAN :'S+ and R->OR+ co!!ands* generate reports on %ackup activities %ased on the RMAN
repository# Bse SHOW A:: to display the current RMAN confguration#
:isting 0ackups
Bse :'S+ to display in&or!ation a%out %ackup sets* pro4y copies* and i!age copies recorded in the
repository# +he :'S+ co!!and displays the fles against which you can run 5ROSS5H-5M and $-:-+-
co!!ands# Bse this co!!and to list/
3J
0ackups and copies that do not have the status ACA':A0:- in the RMAN repository
0ackups and copies o& datafles that are availa%le and can possi%ly %e used in a restore operation
Specifed archived logs* %ackup sets* %ackup pieces* control fle copies* datafle copies* and pro4y
copies
0ackups and copies restricted %y tag* co!pletion ti!e* recovera%ility* or device
'ncarnations o& a specifed data%ase or o& all data%ases known to the repository
Stored scripts in the recovery catalog
Reporting on $ata%ase 6iles and 0ackups
+he R->OR+ co!!and per&or!s !ore co!ple4 analysis than :'S+# Bse the R->OR+ co!!and to answer
uestions such as the &ollowing/
Which fles need a %ackup?
Which fles have not had a %ackup &or so!e ti!e?
Which fles are not recovera%le due to unrecovera%le operations?
Which %ackup fles can %e deleted?
What was the physical sche!a o& the data%ase at a previous ti!e

Oracle3;g $ocu!entation Re&erences/
See Oracle $ata%ase 0ackup and Recovery 0asics . learn how to !ake lists and reports
See Oracle $ata%ase 0ackup and Recovery Re&erence . co!plete :'S+ and R->OR+ co!!and synta4

Managing t#e RMAN Repositor)
RMAN repository !etadata is always recorded in the control fle o& the target data%ase# ,ou can also create
a recovery catalog in a separate data%ase* and RMAN will record its !etadata there as well#
Monitoring 5ontrol 6ile Records /
'& you do not use a recovery catalog* then eventually RMAN control fle records are overwritten# Set this
initiali2ation para!eter in the para!eter fle o& the target data%ase to deter!ine how long records are
kept/
5ON+RO:?6':-?R-5OR$?M-->?+'M- W Gnu!%er?o&?days?to?keepH
,ou can confgure a retention policy to %e used %y RMAN to deter!ine which %ackups are considered
o%solete# +his allows you to re!ove fles &ro! the repository that are no longer needed to !eet your
retention reuire!ents# +his policy can %e %ased on a recovery window 7the !a4i!u! nu!%er o& days
into the past &or which you can recover8 or redundancy 7how !any copies o& each %acked.up fle to keep8#
3K
+he R-5OC-R, W'N$OW para!eter o& the 5ON6'@BR- co!!and specifes the nu!%er o& days %etween
the current ti!e and the earliest point o& recovera%ility# RMAN does not consider any &ull or level ;
incre!ental %ackup as o%solete i& it &alls within the recovery window# Additionally* RMAN retains all
archived logs and level 3 incre!ental %ackups that are needed to recover to a rando! point within the
window#
Run the 5ON6'@BR- R-+-N+'ON >O:'5, co!!and at the RMAN pro!pt# +his e4a!ple ensures that you
can recover the data%ase to any point within the last week/

RMAN> C,N01*2R+ R+)+N)1,N 5,L1C- ), R+C,7+R- /1N6,/ ,0 C 6A-S
+he R-$BN$AN5, para!eter o& the 5ON6'@BR- R-+-N+'ON >O:'5, co!!and specifes how !any
%ackups o& each datafle and control fle that RMAN should keep# 'n other words* i& the nu!%er o& %ackups
&or a specifc datafle or control fle e4ceeds the R-$BN$AN5, setting considers the e4tra %ackups as
o%solete# +he de&ault retention policy is R-$BN$AN5,W3#

As you produce !ore %ackups* RMAN keeps track o& which ones to retain and which are o%solete# RMAN
retains all arcd logs and incre!ental %ackups that are needed to recover the nono%solete %ackups#
Assu!e that you !ake a %ackup o& datafle O on Monday* +uesday* Wednesday* and +hursday# ,ou now
have &our %ackups o& the datafle# '& R-$BN$AN5, is 9* then the Monday and +uesday %ackups are
o%solete# '& you !ake another %ackup on 6riday* then the Wednesday %ackup %eco!es o%solete#
Run the 5ON6'@BR- R-+-N+'ON >O:'5, co!!and at the RMAN pro!pt* as in the &ollowing e4a!ple/
RMAN> C,N01*2R+ R+)+N)1,N 5,L1C- ), R+62N6ANC- >;
RMAN does not auto!atically delete %ackups rendered o%solete %y the retention policy# 'nstead* RMAN
shows the! as O0SO:-+- in the R->OR+ O0SO:-+- output and in the O0SO:-+- colu!n o&
CV0A5MB>?6':-S# RMAN deletes o%solete fles i& you run the $-:-+- O0SO:-+- co!!and#
Note* %ackups in the Rash recovery area are suscepti%le to deletion %ased on RMAN retention
policy confguration#
Oracle3;g $ocu!entation Re&erences/
Oracle $ata%ase 0ackup and Recovery 0asics. !ore in&or!ation regarding retention policies and deleting
o%solete fles


Crossc#ecking an% Deleting /ackups
5rosscheck is needed when an archivelog fle or %ackup is !anually re!oved* i#e#* not deleted %y RMAN#
+his co!!and ensures that data a%out %ackups in the recovery catalog or control fle is synchroni2ed with
corresponding data on disk or in the !edia !anage!ent catalog# +he 5ROSS5H-5M co!!and operates
only on fles that are recorded in the recovery catalog or the control fle#
+he 5ROSS5H-5M co!!and does not delete any fles that it is una%le to fnd* %ut updates their repository
records to -A>'R-$# +hen* you can run $-:-+- -A>'R-$ to re!ove the repository records &or all e4pired
3Q
fles as well as any e4isting physical fles whose records show the status -A>'R-$#
'& so!e %ackup pieces or copies were erroneously !arked as -A>'R-$* &or e4a!ple* %ecause the !edia
!anager was !isconfgured* then a&ter ensuring that the fles really do e4ist in the !edia !anager* run
the 5ROSS5H-5M 0A5MB> co!!and again to restore those fles to ACA':A0:- status#
5rosschecking 0ackups
RMAN> H chec%s RMAN bac%ups on conf'gured deE'ces
CR,SSC.+C4 3AC425;
H chec%s RMAN 'mage cop'es on conf'gured deE'ces>
CR,SSC.+C4 C,5-;

'& %ackups are stored with a !edia !anager and s%t channels are not confgured* then you !ust allocate
!aintenance channel %e&ore 5ROSS5H-5M and $-:-+- co!!ands on s%t devices/
RMAN> ALL,CA)+ C.ANN+L 0,R MA1N)+NANC+ 6+71C+ )-5+ sbt;
CR,SSC.+C4 3AC425;

+he $-:-+- co!!and re!oves RMAN %ackups and copies &ro! $'SM and s%t devices* !arks theects as
$-:-+-$ in the control fle* and re!oves the records &ro! the recovery catalog 7i& you use a catalog8# 6or
e4a!ple/
RMAN> 6+L+)+ 3AC425S+) =<=; =<:; =<>;
6+L+)+ C,N)R,L01L+C,5- 8!tmp!cf&cp8;
6+L+)+ N,5R,M5) ARC.17+L,* 2N)1L S+Q2+NC+ @ C><<;
6+L+)+ 3AC425 ,0 S501L+ )A3L+S5AC+ users 6+71C+ )-5+ sbt;
6+L+)+ 3AC425 ,0 6A)A3AS+ L14+ 8!tmp(8; H pattern match
6+L+)+ ARC.17+L,* ALL 3AC4+6 25 : )1M+S ), 6+71C+ )-5+ sbt;
3O

You might also like