0% found this document useful (0 votes)
5 views27 pages

Comp1638 L9

The document discusses database backup and recovery, outlining the importance of protecting databases against data loss and the various types of failures that can occur. It details strategies for preparing a database for recoverability, including the use of logical and physical backups, and emphasizes the need for a robust backup strategy. Additionally, it covers the recovery process and the tools available for performing backups, such as Recovery Manager (RMAN).

Uploaded by

chihanaomega97
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views27 pages

Comp1638 L9

The document discusses database backup and recovery, outlining the importance of protecting databases against data loss and the various types of failures that can occur. It details strategies for preparing a database for recoverability, including the use of logical and physical backups, and emphasizes the need for a robust backup strategy. Additionally, it covers the recovery process and the tools available for performing backups, such as Recovery Manager (RMAN).

Uploaded by

chihanaomega97
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Database Backup and

Recovery

Database Management and Administration


Dr Tatiana Simmonds
Previously . . .
 Described Flashback Technology
 Recovered dropped tables with the Flashback Drop
 Used Flashback Table to restore the contents of a
table to a specific point in the past
 Discussed Flashback Database option
 Introduced Flashback Query

T.Simmonds 2
Objectives
Discuss Backup and Recovery
Describe different types of failure in the
database
Preparing a database for recoverability
Discuss details of instance recovery
Develop backup strategy
Logical and physical backups
Perform backups
The database recovery process from a backup

T.Simmonds 3
Database Backup and
Recovery

Part1

Database Management and Administration


Dr Tatiana Simmonds
Problems
 Computer systems fail.
 Hardware breaks.
 Programs have bugs.
 Human procedures contain errors, and people make
mistakes.
 All of these failures can and do occur in database
applications.
 Because a database is shared by many people and
because it often is a key element of an organization’s
operations, it is important to recover it as soon as
possible.
T.Simmonds 5
What is Backup and Recovery?
In general, backup and recovery refers to the various
strategies and procedures involved in protecting your
database against data loss and reconstructing the
database after any kind of data loss.
Oracle Database provides a sophisticated set of
facilities and utilities for backup and recovery
processing.
 They can be used in many different ways to provide
appropriate backup and recovery for databases,
 ranging from a small workgroup database that can be backed
up when it is unused at night
 to large inter-organisational databases that must be
operational 24 hours per day, 7 days per week (24/7) and can
never be shut down.
T.Simmonds 6
What is Availability?
Availability is the degree to which an application,
service, or function is accessible on demand
 It is measured by the perception of an application's end
user, but increasingly, availability is measured in dollars,
euro, and yen, not just in time and convenience
Primary characteristics of a highly available solution:
 Reliability
 Recoverability
 Timely error detection
 Continuous operations

T.Simmonds 7
Backup and Recovery Issues
Oracle Database maintains three types of files that
are important for backup and recovery:
 datafiles
 contain user and system data
 redo log files
 contain logs of database changes
 control files
 small files that store the SCN and the name, contents, and
locations of various files used by a database.
 control files are frequently updated by a database, and they
must be available for a database to be operational

T.Simmonds 8
What can go wrong?
Database recovery techniques depend on the
type of failure.
Following types of failures can occur in the
database:
 Statement failure
 User process failure
 Network failure
 User error
 Media failure
 Instance failure
T.Simmonds 9
Database Backup and
Recovery

Part2

Database Management and Administration


Dr Tatiana Simmonds
Statement failure
An individual SQL statement can fail for a number
of reasons:
 Constraint violation
 Insufficient privileges
 Logic errors in applications
 Space management problem

Possible solutions:
 Work with users to validate and correct data
 Provide appropriate object or system privileges
 Work with developers to correct program errors
T.Simmonds 11
User process failure
A user process may fail for any number of reasons:
 User exits abnormally
 A user’s session is abnormally terminated
 The terminal rebooting
 The program causing an error that
terminates the session
Possible solutions:
 This type of problem is beyond the DBA’s control
 PMON will roll back the transaction, terminate the server
process and release the PGA to the operating system
 Watch for multiple occurrences which might indicate other
problems

T.Simmonds 12
Network failure
Potential network problems:
 Listener fails
 Network Interface Card (NIC) fails
 Network connection fails

Possible solutions:
 Configure a backup listener and connect-time
failover
 Configure multiple network cards
 Configure a backup network connection
 Work together with the network administrators
T.Simmonds 13
User error
Users errors used to be the worst errors to manage
User errors are not errors as far as database is
concerned:
 User commits unwanted changes
 User drops the table
Possible solutions:
 To prevent them from occurring in the first place
 software design
 user training
 correct privileges

 Flashback technology
T.Simmonds 14
Media failure
 A media failure occurs when Oracle Database is unable to
write to a physical file.
 This may occur because of a disk head crash or other disk
failure, because needed devices are not powered on, or because
a file is corrupt.
 Media failure means
 damage to disks, and therefore the files on them
 user error when system or database administrator accidently deleted files
 loss any of on line redo log files, data files or control file

 Possible solutions:
 Prevention and protection
 protect control file and online redo log files through multiplexing
 protect archive log files
 good backup strategy

 Restore and recover the missing files


T.Simmonds 15
Instance failure
An instance failure is a disorderly shutdown
of the instance, also known as crash
This could be caused by
 a power outage
 switching off or rebooting the server machine
 any hardware problems
 failure of one of the background processes
 shutdown abort command
Possible solutions:
 Instance recovery
T.Simmonds 16
Instance Recovery
An instance recovery
 is automatic and unavoidable
 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: Data files are restored to their state before
the instance failed
 Rolling back: Changes that are made but not committed are
returned to their original state
T.Simmonds 17
Instance Recovery: Details
 On starting an instance SMON process reads the control
file and puts the database into a mount state
 Then SMON checks the file headers of all the datafiles and online
redo log file
 If the file headers are out of sync, SMON starts instance
recovery routine:
 Rolls forward – using the contents of the online redo log files
rebuilds the database buffer cache to the state it was before the
crash
 Opens database
 Rolls back – all uncommitted transactions are rolled back (using
undo)

T.Simmonds 18
Database Backup and
Recovery

Part3

Database Management and Administration


Dr Tatiana Simmonds
Preparing a Database for Recoverability
 To configure your database for maximum
recoverability:
 The control file must be multiplexed
 The online redo logs must be multiplexed
 The database must be running in ARCHIVELOG
mode, with the archive log files also multiplexed
 There must be regular backups

T.Simmonds 20
Backup Overview
Backup and recovery is one of the most
important aspects of a database management
A backup strategy provides
a safeguard against data loss
A backup is a copy of data from
your database that can be used to
reconstruct that data.
Backups can be divided into logical and physical
backups, both of which have a number of options
available
T.Simmonds 21
Logical Backups
 Logical backups of a database contains logical data
such as tables and stored procedures.
 Logical backups exported from a database with an
Oracle export utility and stored in a binary file, for later
re-importing into a database using the corresponding
import utility.
 The records are read independently of their physical location.
 Export file will contain the commands necessary to
completely re-create all the chosen objects and data.
 Data Pump Import utility is used to import the data.

T.Simmonds 22
Physical Backups
Physical backups are the foundation of any sound
backup and recovery strategy
A physical backup involves copying the files that
constitute the database (datafiles, control files, and
archived redo logs)
Logical backups are a useful supplement to
physical backups but are not sufficient protection
against data loss without physical backups
An effective backup strategy must be based on
physical backups
T.Simmonds 23
Physical Backup Options
 Backup strategies:
 Whole: A backup of the control file and all datafiles that belong to a
database
 Partial: A portion of the database

 Backup types:
 Full: A non-incremental RMAN backup
 Incremental: Only information that has changed since some previous
backup
 Backups modes:
 Offline: Consistent, also referred to as cold backup
 Online: Inconsistent, also referred to as hot backup

 Backups storage:
 Image copies: Duplicate data and log files in OS format
 Backup sets: Binary, compressed files in Oracle proprietary format

T.Simmonds 24
Backup Tools
Backups can be performed by using:
Recovery Manager (RMAN)
 is the recommended method of backing up your Oracle
database
Oracle Secure Backup
 complements RMAN existing functionality by adding
backup to tape and network backup capabilities
User-managed backup
 is based on scripts that a DBA must write
 Carried out with OS commands
 is being phased out

T.Simmonds 25
The Database Recovery Process
Reconstructing the contents of all or part of a
database from a backup typically involves two
phases:
 retrieving a copy of the datafile from a backup,
 reapplying changes to the file since the backup
from the archived and online redo logs, to bring
the database to a desired SCN since the backup
(usually, the present).

T.Simmonds 26
Essentials
 Discuss Backup and Recovery
 Describe different types of failure in the
database
 Preparing a database for recoverability
 Discuss details of instance recovery
 Develop backup strategy
 Logical and physical backups
 Perform backups
 The database recovery process from a backup

T.Simmonds 27

You might also like