rman tutorials
TRANSCRIPT
-
8/13/2019 Rman Tutorials
1/7
RMAN TUTORIALS
An RMAN channel represents one stream of data to a device type and
corresponds to one server session. Allocation of one or more RMAN
channels is necessary to execute most ac!up and recovery commands.
As illustrated in "i#ure$ each channel estalishes a connection from the
RMAN executale to a tar#et or auxiliary dataase instance y startin#
a server session on the instance. The server session performs theac!up$ restore$ and recovery operations. Only one RMAN session
communicates %ith the allocated server sessions.
&ou can either allocate channels manually %ithin a RUNloc!$ or
preconfi#ure channels for use in all RMAN sessions usin# automatic
channel allocation. RMAN comes preconfi#ured %ith a DISKchannel
that you can use for ac!ups and copies to dis!. &ou can also run the
CONFIGURECHANNELcommand RMAN to specify automatic channels
to dis! or tape. In this %ay$ you do not have to allocate channels every
time you perform a ac!up$ restore$ or recovery operation.
'hen you run a command that re(uires a channel$ and you do not
allocate a channel manually$ then RMAN automatically allocates the
channels usin# the options specified in the CONFIGUREcommand. "or
the BACKUPcommand$ RMAN allocates only a sin#le type of channel$
such as DISKor sbt. "or the RESTOREcommand and the variousmaintenance commands )for example$ DELETE*$ RMAN determines
%hich device types are re(uired$ and allocates all necessary channels.
If you specify channels manually$ then theALLOCATE CHANNELcommand
)executed only %ithin a RUNcommand* andALLOCATE CHANNEL FOR
MAINTENANCEcommand )executed only at the RMAN prompt* specify the
-
8/13/2019 Rman Tutorials
2/7
type of I+O device that the server session %ill use to perform the
ac!up$ restore$ or maintenance operation.
Unless you manually run anALLOCATECHANNELcommand$ RMAN
allocates automatic channels accordin# to the settin#s in these
commands,
CONFIGUREDEVICE TYPE...PARALLELISM
CONFIGUREDEFAULTDEVICETYPE
CONFIGURECHANNELDEVICETYPE
CONFIGURECHANNELnDEVICETYPE
"or example$ you can issue the follo%in# commands at the RMAN
prompt,
BACKUP DATAFILE 3;RUN { RESTORE TABLESPACE uses; !
RMAN automatically allocates channels accordin# to values set %ith the
CONFIGUREcommand in the follo%in# cases,
&ou use commands such as BACKUP$ RESTORE$ or DELETE
outside of a RUNloc!.
&ou use commands %ithin a RUNloc! ut do not allocate any
channels %ithin the RUNloc!.
&ou can override automatic channel allocation settin#s y manually
allocatin# channels %ithin a RUNloc!. &ou cannot mix automatic and
manual channels$ so manual channels al%ays override automatic
channels. "or example$ you override automatic channel allocation %hen
you issue a command as follo%s,
RUN{ ALLOCATE CHANNEL "# DEVICE TYPE sbt;
BACKUP DATABASE PLUS ARCHIVELOG;!
RMAN internally handles paralleli-ation of BACKUP$ COPY$ and
RESTOREcommands. &ou only need to specify,
MultipleALLOCATE CHANNELcommands
-
8/13/2019 Rman Tutorials
3/7
The oects that you %ant to ac! up$ copy$ or restore
RMAN executes commands se(uentially/ that is$ it completes the
current command efore startin# the next one. 0arallelism is exploited
only %ithin the context of a sin#le command. 1onse(uently$ to create
three ac!ups of a datafile$ issue a sin#le BACKUPcommand specifyin# all
three datafiles rather than three separate BACKUPcommands.
In Oracle2i$ theALLOCATE CHANNELcommand causes RMAN to contact the
media mana#er %henever the type specified is other than DISK. In
releases efore Oracle2i$ theALLOCATE CHANNELcommand does not cause
RMAN to contact the media mana#er/ RMAN does not call the media
mana#er unless a BACKUP$ RESTORE$ or RECOVERcommand is issued.
Note:
'hen you specify DEVICETYPE DISK%ith any version of RMAN$ RMAN
does not allocate operatin# system resources other than for the creationof the server session and does not call the media mana#er.
'hen you execute the BACKUPcommand$ you create one or more ac!up
sets. A ac!up set$ %hich is a lo#ical oect$ contains one or more
physical ac!up pieces. 3y default$ one ac!up set contains one ac!up
piece. 3ac!up pieces are operatin# system files that contain the ac!ed
up datafiles$ control files$ or archived redo lo#s. "or example$ you can
ac! up ten datafiles into a sin#le ac!up set containin# a sin#le ac!up
piece )that is$ a sin#le output file*. &ou cannot split a file across different
ac!up sets or mix archived lo#s and datafiles into one ac!up set.
A ac!up set is a complete set of ac!up pieces that ma!e up a full or
incremental ac!up of the oects specified in the BACKUPcommand.
3ac!up sets are in an RMAN4specific format. An ima#e copy$ %hich is a
complete ima#e of a sin#le datafile$ control file$ or archived lo#$ is not in
an RMAN4specific format.
BACKUP DATABASE;BACKUP TABLESPACE uses$ t%%&s;
BACKUP 'SPFILE( 'CURRENT CONTROL FILE(;BACKUP BACKUPSET #);BACKUP DATAFILECOPY *+t,-+sste,/#.0b1*;
'hen ac!in# up datafiles$ the tar#et dataase must e mounted or
open. If the dataase is inARCHIVELOGmode$ then the tar#et can e open
or closed, you do not need to close the dataase cleanly. If the dataase
-
8/13/2019 Rman Tutorials
4/7
is inNOARCHIVELOGmode$ then you mustclose it cleanly efore ma!in# a
ac!up.
RMAN -e1%,s compression%2 ts b4"5u-s$ 67"7,e42s t74t 04t41&e b&%"5s t74t 748e 2e8e bee2use0 4e 2%t b4"5e0 u-. I,49e "%-es %1 4 04t41&e$7%6e8e$ 4&64s "%2t42 4&& 04t41&e b&%"5s.
Table Backup Types
BackupType Definition
"ullA ac!up that is not incremental. A full ac!up includes
all used data loc!s in the datafiles. "ull ac!ups of
control files and archived lo#s al%ays include all loc!s in
the files.
Note, A full ac!up is different from a %hole dataase
ac!up$ %hich is a ac!up of all datafiles and the current
control file.
Incremental A ac!up of datafiles that includes only the loc!s that
have chan#ed since a previous incremental ac!up.
Incremental ac!ups re(uire a full or incremental level 5
ac!up to serve as a asis.
Online A ac!up of online$ read+%rite datafiles %hen the dataaseis open.
Note, 6o not put a talespace in ac!up mode %ith the
ALTERTABLESPACEBEGINBACKUPstatement. RMAN
uses a different method to #uarantee consistency in online
ac!ups.
1losed A ac!up of any part of the tar#et dataase %hen it is
mounted ut not open. 1losed ac!ups can e consistentor inconsistent.
1onsistent A ac!up ta!en %hen the dataase is mounted )ut not
open* and %as notcrashed or shut do%n %ith theABORT
option prior to mountin#. The chec!point S1Ns in the
-
8/13/2019 Rman Tutorials
5/7
BackupType Definition
datafile headers match the header information in the
control file and none of the datafiles has chan#es eyond
its chec!point. 1onsistent ac!ups can e restored %ithout
recovery.
InconsistentA ac!up of any part of the tar#et dataase %hen
It is open.
It crashed or a SHUTDO:NABORT%as run
prior to mountin#.
An inconsistent ac!up re(uires recovery to ecome
consistent.
How Incremental Backups Work
7ach data loc! in a datafile contains a system chan#e numer )S1N*$
%hich is the S1N at %hich the most recent chan#e %as made to
the loc!. 6urin# an incremental ac!up$ RMAN reads the S1N
of each data loc! in the input file and compares it to the
chec!point S1N of the parent incremental ac!up. RMAN reads
the entire file every time %hether or not the loc!s have een
used.
The parent ac!up is the ac!up that RMAN uses for comparin# the
S1Ns. If the current incremental is a differential ac!up at level n$ then
the parent is the most recent incremental of level nor less. If the current
incremental is a cumulative ac!up at level n$ then the parent is the
most recent incremental of level n48 or less. If the S1N in the input data
loc! is #reater than or e(ual to the chec!point S1N of the parent$ then
RMAN copies the loc!.
The BACKUPcommand can ac! up the follo%in# types of files,
6ataase$ %hich includes all datafiles as %ell as the current
control file and current server parameter file
Talespaces )except for locally4mana#ed temporary talespaces*
1urrent datafiles
1urrent control file
Archived redo lo#s
-
8/13/2019 Rman Tutorials
6/7
1urrent server parameter file
3ac!up sets
RMAN does not ac! up the follo%in#,
Online redo lo#s
Transported talespaces efore they have een made read+%rite
1lient4side initiali-ation parameter files or noncurrent server
parameter files.
If CONFIGURECONTROLFILEAUTOBACKUPis ON)y default it is
OFF*$ then RMAN automatically ac!s up the control file and the
current server parameter file )if used* in the follo%in# circumstances,
After every BACKUPor COPYcommand issued at the RMAN
prompt.
'henever a BACKUPor COPYcommand %ithin a RUNloc! is
follo%ed y a command that is neither BACKUPnor COPY. At the end of every RUNloc! if the last command in the loc!
%as either BACKUPor COPY.
After dataase structural chan#es such as addin# a ne%
talespace$ alterin# the state of a talespace or datafile )for
example$ rin#in# it online*$ addin# a ne% online redo lo#$
renamin# a file$ addin# a ne% redo thread$ and so forth. This type
of autoac!up$ unli!e autoac!ups that occur in the precedin#
circumstances$ is only on dis!. &ou can run CONFIGURECONTROLFILE
AUTOBACKUPFORDEVICETYPEDISKto set a nondefault dis! location.Note that the autoac!up never causes the associated structural
chan#e to fail. "or example$ if you add a datafile$ and if the
resultin# autoac!up fails$ then the datafile addition is still
successful.
Test Backups Using RMAN
ou can run t!e BACKUP...VALIDATEcomman" to "o t!e
following:
1hec! datafiles for physical and lo#ical corruption 1onfirm that all dataase files exist and are in the correct
locations
-
8/13/2019 Rman Tutorials
7/7