Transcript backup

Backup & Recovery
Concepts for Oracle
Database
CIS 764
Mustafa Mohammed
November 25, 2008
Contents






Basics of Backup & Recovery.
Different types of failure that can occur.
What Information should be backed up?
Logical backup-Exports & Imports.
Why do we use Logical backup?
Advantages & Disadvantages of Logical
Backup.
Basics of Backup and Recovery




Def:- A backup is a representative copy of data.
It includes important parts of database such as
the control file, redo logs and data-files.
Purpose:- It protects data from application error
and safeguards against unexpected data loss, by
providing a way to restore original data.
Backups are divided into two types:
- Physical Backup
- Logical Backup





Physical backups are copies of physical database
files.
To restore a Physical backup is to reconstruct it and
make it available to the Oracle server.
To recover a restored backup, data is updated using
redo records from the transaction log.
Logical backups contain data that is exported using
SQL commands and stored in a binary file.
These are used as to supplement physical backups.
Different types of failure that can
occur






Instance failure: Usually connected with an Oracle
process failure
Media failure: Disk failure, storage array controller
failure etc
Block Corruption: Usually caused by bugs in Oracle
software
Human error: In most cases accidentally
deleted/updated data Database user or DB
Statement failure: a statement which is not of a valid
SQL construction.
Disaster: Fire, flood, earthquake, plane crash etc.
What Information should we
backup?

When developing a backup strategy , a DBA must decide the type of
information to be backed up.

The basic backup types include:
- Online Database Backup
- Offline Database Backup
- Whole Database Backup
- Tablespace Backup
- Data-file Backup
- Control File Backup
Logical Backup- Exports & Imports



These are utilities that allow us to make exports and imports of
data objects( such as tables).
Exp/Imp allows transferring data across DB’s that reside on
different hardware platforms or on different Oracle versions.
Exp/Imp can be used in four modes:
- Full Export: The EXP_FULL_DATABASE and
IMP_FULL_DATABASE are used to perform full export.
- Tablespace: use the tablespaces export parameter for a
tablespace export.
- User: This mode can be used to export and import all objects
that being to a user.
- Table: Specific tables can be exported/imported with table
export mode.

Sample Syntax for Full DB Exp/Imp
$ exp file=full.dmp log=fulldb.log full=Y
$ imp file=full.dmp log=fulldb.log
Why do we use Logical Backup?

It makes transferring DB easy when migrating from one OS to another;
say from NT to Solaris as it is platform independent. We achieve this by
exporting from NT and importing into Solaris.

Simplifies the task of upgrading Oracle versions.
Ex: upgrading from 9i to 10g , we first perform Oracle “Exp” on 9i DB
and then upgrade the Server to 10g including DB upgrade.

To take objects from one DB to another DB or from one user to another.

For large database’s LB provides an incremental export which is
performed on weekdays and a complete export on weekends.
Advantages & Disadvantages of
Logical Backup




ADV:Enables to copy objects from 1 schema to another within a database.
Enables to copy objects across the DB’s running either in the same
server or in the different servers.
DISADV:LB is very slow when compared with PB as it is done by file level at OS
level whereas in LB, we need to make selections from each table.
Import is much slower(8-10 times) since it is DDL+DML which
eventually involves more I/O operations.
QUESTIONS?
References

Backup and Recovery in Oracle—“Oracle site” November 25 2008
http://downloaduk.oracle.com/docs/cd/B19306_01/server.102/b14220/backrec.htm

Backup and Recovery concepts -- Wikipedia: The Free Encyclopedia
November 25 2008
<http://en.wikipedia.org/wiki/Backup_and_Recovery>

Backup and Recovery Overview and Configuration in Oracle9i
<http://pd.acm.org/sks_course.cfm?crs=66137_eng>