Backup and Recovery: Concepts
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Objectives
After completing this lesson, you should be able to:
• Identify the types of failure that can occur in an Oracle
database
• Describe instance recovery
• Describe complete and incomplete recovery
12 - 2 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
DBA Responsibilities
• Protect the database from failure wherever possible
• Increase the mean time between failures (MTBF)
• Protect critical components by using redundancy
• Decrease the mean time to recover (MTTR)
• Minimize the loss of data
12 - 3 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Categories of Failure
Failures can generally be divided into the following categories:
• Statement failure
• User process failure
• Network failure
• User error
• Instance failure
• Media failure
12 - 5 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Statement Failure
Typical Problems Possible Solutions
Attempts to enter invalid data into a Work with users to validate and
table correct data.
Attempts to perform operations with Provide appropriate object or system
insufficient privileges privileges.
Attempts to allocate space that fail • Enable resumable space
allocation.
• Increase owner quota.
• Add space to tablespace.
Logic errors in applications Work with developers to correct
program errors.
12 - 6 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
User Process Failure
Typical Problems Possible Solutions
A user performs an abnormal A DBA’s action is not usually needed
disconnect. to resolve user process failures.
Instance background processes roll
A user’s session is abnormally back uncommitted changes and
terminated. release locks.
A user experiences a program error
that terminates the session. Watch for trends.
12 - 7 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Network Failure
Typical Problems Possible Solutions
Listener fails. Configure a backup listener and
connect-time failover.
Network Interface Card (NIC) fails. Configure multiple network cards.
Network connection fails. Configure a backup network
connection.
12 - 8 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
User Error
Typical Causes Possible Solutions
User inadvertently deletes or Roll back transaction and dependent
modifies data. transactions or rewind table.
User drops a table. Recover table from recycle bin.
Recover table from a backup.
Oracle LogMiner
12 - 9 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Flashback Technology
Use Flashback technology for:
• Viewing past states of data
• Winding data back and forth in time
• Assisting users in error analysis and recovery
For error analysis: For error recovery:
Oracle Flashback Query Oracle Flashback Transaction Backout
Oracle Flashback Versions Query Oracle Flashback Table
Oracle Flashback Transaction Query Oracle Flashback Drop
Oracle Flashback Database
12 - 10 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Instance Failure
Typical Causes Possible Solutions
Power outage Restart the instance by using the
STARTUP command. Recovering
from instance failure is automatic,
Hardware failure including rolling forward changes in
the redo logs and then rolling back
any uncommitted transactions.
Failure of one of the critical
background processes
Investigate the causes of failure by
using the alert log, trace files, and
Emergency shutdown procedures
Enterprise Manager.
12 - 12 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Understanding Instance Recovery:
Checkpoint (CKPT) Process
CKPT is responsible for:
SGA
• Updating data file headers with
checkpoint information
Database
• Updating control files with buffer cache
checkpoint information
• Signaling DBWn at
full checkpoints DBWn
Database Writer
process
Control
files
CKPT
Checkpoint process Data files
12 - 13 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Understanding Instance Recovery:
Redo Log Files and Log Writer
Redo log files:
SGA
• Record changes to the
database
Redo log buffer
• Should be multiplexed to
protect against loss
LGWR
Log Writer (LGWR) writes:
Log Writer
• At commit
• When one-third full
• Every three seconds
Redo log Redo log Redo log
group 1 group 2 group 3 • Before DBWn writes
• Before clean shutdowns
12 - 14 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Understanding Instance Recovery
Automatic instance or crash recovery:
• Is caused by attempts to open a database whose files are
not synchronized on shutdown
• Uses information stored in redo log groups to synchronize
files
• Involves two distinct operations:
– Rolling forward: Redo log changes (both committed and
uncommitted) are applied to data files.
– Rolling back: Changes that are made but not committed are
returned to their original state.
12 - 15 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Phases of Instance Recovery
1. Instance startup (data files Instance
are out of sync) SGA
2. Roll forward (redo)
3. Committed and uncommitted Background
processes
data in files
4. Database opened Database
5. Roll back (undo)
6. Committed data in files SCN:
SCN:140 SCN:143 74-101
SCN:
SCN:129 SCN:143 102-143
Undo
SCN: 99
Control Redo log
Data files files group
12 - 16 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Tuning Instance Recovery
• During instance recovery, the transactions between the
checkpoint position and the end of redo log must be
applied to data files.
• You tune instance recovery by controlling the difference
between the checkpoint position and the end of redo log.
Checkpoint position End of redo log
Instance recovery
Transactions
12 - 17 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Using the MTTR Advisor
• Specify the desired time in seconds or minutes.
• The default value is 0 (disabled).
• The maximum value is 3,600 seconds (one hour).
12 - 18 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Media Failure
Typical Causes Possible Solutions
Failure of disk drive 1. Restore the affected file from
backup.
2. Inform the database about a new
Failure of disk controller
file location (if necessary).
3. Recover the file by applying redo
Deletion or corruption of a file information (if necessary).
needed for database operation
12 - 19 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Comparing Complete and Incomplete Recovery
Recovery can have two kinds of scope:
• Complete recovery: Brings the database or tablespace up
to the present, including all committed data changes made
to the point in time when the recovery was requested
• Incomplete or point-in-time recovery (PITR): Brings the
database or tablespace up to a specified point in time in
the past, before the recovery operation was requested
Time of
Complete crash
recovery
Point-in-time
recovery Recovery
Restore from Missing transactions task started
this backup after point-in-time recovery at this time
12 - 20 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Complete Recovery Process
Archived
log Archived
log Online
Redo log
Changes applied Undo applied
2 4
1 3 5
Restored Data files containing
data files committed and uncommitted Recovered
transactions data files
12 - 21 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Point-in-Time Recovery Process
Archived
log Archived
X
log Online
Redo log X
Changes applied to point in time (PIT) Database
opened Undo applied
2
4 5
1 3 6
Restored data Data files containing
committed and PIT-recovered
files from as far
uncommitted data files
back as necessary
transactions up to PIT
12 - 22 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Oracle Data Protection Solutions
Backup and Recovery Time Oracle Solution
Recovery Objective Objective (RTO)
Physical data protection Hours/Days Recovery Manager
Oracle Secure Backup
Logical data protection Minutes/Hours Flashback Technologies
Recovery analysis Minimize time for problem Data Recovery Advisor
identification and recovery
planning
Disaster Recovery Recovery Time Oracle Solution
Objective Objective (RTO)
Physical data protection Seconds/Minutes Data Guard
Active Data Guard
12 - 24 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Quiz
Statement failure is never by design and always requires the
DBA to address the issue.
a. True
b. False
12 - 25 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Summary
In this lesson, you should have learned how to:
• Identify the types of failure that can occur in an Oracle
database
• Describe instance recovery
• Describe complete and incomplete recovery
12 - 26 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.