PF I DTB BK Performing Database Backups
PF I DTB BK Performing Database Backups
PF I DTB BK Performing Database Backups
P f
Performing
i Database
D t b Backups
B k
s a
) h a
c o m d e ฺ
ฺ
ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non
Objectives
s a
) h a
c o m d e ฺ
ฺ
ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non
recovery
area or
other disk Backup pieces
Archive areas
log files RMAN
Backup to disk B k d
Backup data
t
Backup
Backup
with
to SBT RMAN third-
Control channel party
file
media s a
Target database manager a
)h ฺ
m
Media Management
a i l ฺco uide
(Example: Oracle Secure
g m Backup) n t G
Oracle
e d@ toSTape
Backup t ude
Non database files
Secure
Backupoh
am this
l e ฺm use
o r ac se to
b ( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,
m ed rab
Recoveryo a ns(RMAN)
hManager fe is the recommended method of backing up your Oracle
m -trcan
database. You
a use it to back up to disk or to a system backup to tape (SBT) channel.
o n
Oracle n
recommends that disk backups be stored in the fast recovery area (FRA).
Oracle Secure Backup complements existing functionality by adding backup to tape and
backup of file system data. It interacts transparently with RMAN. Third-party media managers
can also be used to back up to tape.
User-managed backups are non-RMAN backups, for example, using an OS utility. They are
often based on scripts that a DBA must write. This option is being phased out because it is
more labor intensive.
A user-managed scenario:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ
o m e
• Backup mode may be: a ilฺc Guid
– Offline (consistent, cold) g m ent
e d@ SControl t ud
– Online (inconsistent, hot) am i s Online
o h Dataefiles t h files redo log
m
leฺ to us
Database files
r a c
b ( o
e n se
a za le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,
m ed rab
o
Whole database sfe Includes all data files and at least one control file (Remember that
ha anbackup:
m -trin a database are identical.)
all control files
n o n
Partial database backup: May include zero or more tablespaces and zero or more data files;
may or may not include a control file
Full backup: Makes a copy of each data block that contains data and that is within the files
being backed up
Incremental backup: Makes a copy of all data blocks that have changed since a previous
backup. Oracle Database supports two levels of incremental backup (0 and 1). A level 1
incremental backup can be one of two types: cumulative or differential. A cumulative backup
backs up all changes since the last level 0 backup. A differential backup backs up all changes
since the last incremental backup (which could be either a level 0 or level 1 backup). Change
Tracking with RMAN supports incremental backups.
Offline backups (also known as “cold” or consistent backup): Are taken while the database is
not open. They are consistent because, at the time of the backup, the system change number
(SCN) in data file headers matches the SCN in the control files.
Online backups
back ps (also known
kno n as “hot” or inconsistent backup):
back p) Are taken while
hile the database
is open. They are inconsistent because, with the database open, there is no guarantee that
the data files are synchronized with the control files.
• Image copies
• Backup sets
m ed rab
o ha Are
Image copies: n s fe
duplicates of data or archived log files (similar to simply copying the files
m t r a
n o n- system commands)
by using operating
Backup sets: Are collections of one or more binary files that contain one or more data files,
control files, server parameter files, or archived log files. With backup sets, empty data blocks
are not stored, thereby causing backup sets to use less space on the disk or tape. Backup
sets can be compressed to further reduce the space requirements of the backup.
Image copies must be backed up to the disk. Backup sets can be sent to the disk or directly to
the tape.
The advantage of creating a backup as an image copy is improved granularity of the restore
operation. With an image copy, only the file or files need to be retrieved from your backup
location. With backup sets, the entire backup set must be retrieved from your backup location
before you extract the file or files that are needed.
The advantage of creating backups as backup sets is better space usage. In most databases,
20% or more of the data blocks are empty blocks. Image copies back up every data block,
even if the data block is empty. Backup sets significantly reduce the space required by the
backup In most systems
backup. systems, the advantages of backup sets outweigh the advantages of image
copies.
m ed rab
o ha ansfe
Full Backups
m -tr
n o n is different from a whole database backup. A full data file backup is a backup
A full backup
that includes every used data block in the file. RMAN copies all blocks into the backup set or
image copy, skipping only those data file blocks that are not part of an existing segment. For a
full image copy, the entire file contents are reproduced exactly. A full backup cannot be part of
an incremental backup strategy; it cannot be the parent for a subsequent incremental backup.
Incremental Backups
An incremental backup is either a level 0 backup, which includes every block in the data files
except blocks that have never been used, or a level 1 backup, which includes only those
blocks that have been changed since a previous backup was taken. A level 0 incremental
backup is physically identical to a full backup. The only difference is that the level 0 backup
(as well as an image copy) can be used as the base for a level 1 backup, but a full backup
can never be used as the base for a level 1 backup.
Incremental backups are specified using the INCREMENTAL keyword of the BACKUP
command. You specify INCREMENTAL LEVEL [0 | 1].
l e m use mode.
transaction only when the database is inฺARCHIVELOG
o r ac se to
b ( en
a a
z le lic
m ed rab
o ha ansfe
m -tr
non
s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
hamacommandss f er
By usingoRMAN n or the Enterprise Manager Cloud Control interface, you can
m
manage the - t r
npersistent
noCloud
backup settings that are used for creating backups. In Enterprise
Manager Control, select Availability > Backup & Recovery > Backup Settings. There
are separate settings for disk and tape. Tape settings depend on the media management
library capabilities. Disk settings include:
• Parallelism: How many separate streams of backup information do you want to create?
The best setting for parallelism depends on your hardware. As hardware resources
increase, the appropriate degree of parallelism also increases. Generally, you want to
set your parallelism to the number of disks that your disk backup location is striped over.
For tape backup, you want to set your parallelism to the same number of tape drives
that you have.
• Disk backup location: Where should backups be stored? The default is the fast
recovery area. If you change this, click Test Disk Backup to verify that RMAN can write
to the new location.
• Disk backup type: Select Backup Set, Compressed Backup Set, or Image Copy.
Click the Backup
p Set tab to set the maximum file size of backup
pppieces,, specify
p y the
compression algorithm to be used for compressed backup sets, and specify redundancy for
tape backups. Host credentials are required to save changes to the backup settings.
Best practice
Backup
pieces
Change
tracking Recovery
Data files file area
s a
)h ฺa
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
hamatabnsto:fe
Click theoPolicy
m -tr
n
• Automatically
noup
back up the control file and server parameter file (SPFILE) with each
backup.
bac You
ou ca
can a
also
so spec
specify y a location
ocat o for
o tthese ese bacbackups ups if you do not
ot want
a t tthem
e to go
to the fast recovery area.
• Optimize backups by not backing up files that exactly match a file that is already part of
the retained backups. This setting enables you to skip read-only and offline data files.
• Enable block change tracking and specify a location for the tracking file. If you intend to
create incremental backups, this setting can decrease the time required to choose which
blocks to include in the incremental backup.
• Exclude tablespaces from a whole database backup. Some administrators choose not to
back up tablespaces containing data or objects that can be easily re-created (such as
indexes or data that is batch-loaded frequently).
• Specify a retention policy: How long should RMAN keep your backups? If you are using
the fast recovery area to store backups, RMAN automatically deletes old backups to
make room for new ones (if the retention policy allows it). By default, only the last
backup is retained. The retention policy can be specified as a number of backups or a
number of days.
backup destination
• Sets up a recovery window for backup management
• Schedules recurring and immediate backups:
Full backup
+ daily incremental
= new “full” backup a
+ daily archived logs for recovery a s
m )h ฺ
o e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o
Enterprise
am nsCloud
hManager fer Control makes it easy for you to set up an Oracle-suggested
m -trathat protects your data and provides efficient recoverability to any point in the
backup strategy
no24 n
preceding hours, and possibly as far back as 48 hours, depending on when the last
backup was created. The Oracle-suggested strategy uses the incremental backup and
incrementally updated backup features, providing faster recoverability than is possible when
applying database changes from the archived redo log files.
Because these backups on disk are retained, you can always perform a full database
recovery or a point-in-time recovery to any time within the past 24 hours, at the minimum. The
recovery time could reach back as far as 48 hours. This is because just before a backup is
taken on a given day
day, the backup from the beginning of day n–1
n 1 still exists.
exists
s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
s f er
haanmaOracle-suggested
m o
To establish
r n strategy, navigate to the database home page > Availability
- t
> Backup &nRecovery > Schedule Backup. The Backup Strategies section enables you to
no the Oracle-suggested backup and Customized backup strategies. The Oracle-
select from
suggested strategy takes a full database copy as the first backup. Because it is a whole
database backup, you might want to consider taking this at the period of least activity. After
that, an incremental backup to disk is taken every day. Optionally, a weekly tape backup can
be made, which backs up all recovery-related files.
By clicking Schedule Customized Backup, you gain access to a wider range of configuration
options. Select the objects that you want to back up—the whole database (the default) or
individual tablespaces,
tablespaces data files
files, archived logs,
logs or any Oracle backups currently residing on
the disk (to move them to the tape).
Both strategies enable you to set up encrypted backups.
s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
haManager
m o
In Enterprise
r a n Database Express, select Storage > Control Files to manage your
t
up to an o -file. A files.
database’sncontrol
trace
Control files have an additional backup option; they may be backed
control file trace backup contains the SQL statement that is required to re-
create the control files in the event that all control files are lost.
Although it is very unlikely that a properly configured database (with multiple copies of the
control file placed on separate disks and separate controllers) would lose all control files at
the same time, it is possible. Therefore, you should back up the control file to a trace file after
each change to the physical structure of the database (adding tablespaces or data files, or
adding additional redo log groups).
T
Trace copies
i off the
th control
t l file
fil can b
be created
t dbby using
i E Enterprise
t i MManager DDatabase
t b
Express, Enterprise Manager Cloud Control, or by using the following SQL command:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE
The trace backup is created in the location specified by the DIAGNOSTIC_DEST initialization
parameter. For example, in this course, the trace file for the orcl database is found in the
/u01/app/oracle/diag/rdbms/orcl/orcl/trace directory and will have a file name
such as o
suc orcl
c _o
oraa_9924.trc.
.t c
s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
haManager
m o
In Enterprise
r a n Cloud Control, select Availability > Backup & Recovery > Manage
t
- to manage your existing backups. On this page, you can see when a backup
Current Backups
non where it was created (disk or tape), and whether it is still available.
was completed,
At the top of the Manage Current Backups page, four buttons enable you to work with existing
backups:
• Catalog Additional Files: Although RMAN (working through Enterprise Manager) is the
recommended way to create backups, you might have image copies or backup sets that
were created by some other means or in some other environment with the result that
RMAN is not aware of them. This task identifies those files and adds them to the
catalog.
catalog
• Crosscheck All: RMAN can automatically delete obsolete backups, but you can also
delete them by using operating system commands. If you delete a backup without using
RMAN, the catalog does not know whether the backup is missing until you perform a
cross-check between the catalog and what is really there.
• Delete All Obsolete: This deletes backups older than the retention policy.
• Delete All Expired: This deletes the catalog listing for any backups that are not found
when the cross-check is performed as described previously.
1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ
$ rman target /
2 RMAN> CONFIGURE …
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
3
s a
a
)h ฺ
o m e
a ilฺc Guid
Control gm
Control n
Archivederedo
t
Data files d@ Stulogdfile
filesfile
e
SPFILE
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ah
1. In o terminal s fer start RMAN and connect to the target database.
am nsession,
m -tra
n- onCONFIGURE DEFAULT DEVICE TYPE TO disk;
2. Execute configuration commands:
s a
) h a
c o m d e ฺ
ฺ
ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o h am nsfer
Answer:
m b -tra
non
s a
) h a
c o m d e ฺ
ฺ
ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non
s a
) h a
c o m d e ฺ
ฺ
ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non