5BackupRecoveryW

35
Backup and Recovery

Transcript of 5BackupRecoveryW

Page 1: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 1/35

Backup and Recovery

Page 2: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 2/35

Backup Types

Logical

Physical

Hot

Cold

Without

With

Page 3: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 3/35

Issues

 –  Protect the database from numerous types of failures

 –  Increase Mean-Time-Between-Failures (MTBF)

 –  Decrease Mean-Time-To-Recover (MTTR)

 –  Minimize data loss

Page 4: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 4/35

Categories of Failures

 –  Statement failure

 –  Logic error in an application

 –  Attempt to enter bad data into the table

 – 

Attempt an operation with insufficientprivileges

 –  Attempt an INSERT or UPDATE to a table,

causing an extent to be allocated,

but with insufficient free space

left in the tablespace

No Recovery Needed 

Page 5: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 5/35

Categories of Failures

 –  Statement failure

 –  User process failure

 –  The user performed an abnormal disconnect

in the session.

 –  The user’s session was abnormally terminated. 

 – 

The user’s program raised an addressexception terminating the session.

No Recovery Needed PMON 

Page 6: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 6/35

Categories of Failures

 –  Statement failure

 –  User process failure

 –  User error

 –  Accidental DROP TABLE;

 –  Accidental TRUNCATE TABLE;

 –  Accidental DELETE / UPDATE;

Recovery Needed 

IMP Utility 

Page 7: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 7/35

Categories of Failures

 –  Statement failure

 –  User process failure

 –  User error

 –  Instance failure

 –  HardWare Problem on CPU / RAM

No Recovery Needed 

PMON SMON 

Page 8: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 8/35

Categories of Failures

 –  Statement failure

 –  User process failure

 –  User error

 –  Instance failure

 –  Media failure

 –  HardWare Problem on I/O Device

Recovery Needed Physical 

Page 9: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 9/35

Requirements for Strategy

 –  Business requirements

• Evolutionary process

 –  Technical requirements

• Hardware, software, man power and time

• Database configurations

• Transaction volume

• Frequency of backups 

 – 

Operational requirements• 7-day / 24-hour operations

• Testing and validating backups 

Page 10: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 10/35

Physical Backup Methods

Physical backup

Archivemode

No archivemode

Page 11: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 11/35

ARCHIVELOG

Archived logfile

052ARC0

LOG_ARCHIVE_DEST

/disk1/archive/

Online redo log files

052

052

Group 2

053

Group 1

053

LOG_ARCHIVE_FORMAT

arch%s.arc

Page 12: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 12/35

Enabling ARCHIVELOG

Mode

Init.ora Control

file 

Shutdown normal or immediate1

Startup mount2

Alter database ARCHIVELOG 3

Alter database open 4

Shutdown normal orimmediate

5

Full database backup6

Page 13: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 13/35

Physical Closed Database Backup

Passwordfile

Online oroffline

storage

Controlfiles

Parameterfiles

Data files Redo logfiles

SHUTDOWN IMMEDIATE;

STARTUP OPEN;

HOST cp <files> /backup/

Page 14: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 14/35

Advantages of Physical Closed

Database Backups

 – Conceptually simple

 – Easy to perform

 – Require little operator interaction

Page 15: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 15/35

Physical Opened Database

Backup (1)

Archived redolog files

Parameterfiles

Pwd file

Onlineredo

log files

Controlfiles

Online oroffline

storage

HOST cp <files> /backup/

Page 16: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 16/35

Data files

Physical Opened Database

Backup (2)

Online oroffline

storage

HOST cp <files> /backup/

SQL> alter tablespace <name> begin backup;

SQL> alter tablespace <name> end backup;

All tablespace datafiles

Individual datafile

Page 17: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 17/35

Advantages of Physical Opened

Database Backups

 – Maintains high database availability

 – Can be done at a tablespace or data file level

 – Supports nonstop business operations

Page 18: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 18/35

Data files

Redo logfiles

Controlfile

1

1

Archived log file

ARC0

1

Page 19: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 19/35

Redo logfiles

Controlfile

2

2

Archived log file

1ARC0

1

2

Data files

Page 20: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 20/35

Redo logfiles

Controlfile

3

3

Archived log file

1ARC0

3

22

Data files

Page 21: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 21/35

Redo logfiles

Controlfile

4

4

Archived log file

1ARC0

3

42

3

Data files

Page 22: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 22/35

Redo logfiles

Controlfile

5

5

Archived log file

1ARC0

5

42

3 4

Data files

Data files

5

Control

file

5

Page 23: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 23/35

Redo logfiles

Controlfile

6

6

Archived log file

1ARC0

5

62

3 4

Data files

Data files

5

Control

file

5

5

Page 24: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 24/35

Redo logfiles

Controlfile

9

9

Archived log file

1ARC0

9

82

3 4

Data files

Data files

5

Control

file

5

5 6

7 8

Page 25: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 25/35

Shutdown1

Startup Mount2

O.S. Restore From Hot or Cold Physical BackUp DataFile (s)3

Redo logfiles

Controlfile

9

9

Data files

9

9

85

Recover DataFile (s) Automatic4

Applyed Archived Logs #5 #6 #74a

Applyed On Line Logs #8 #94b

Alter DataBase Open5

9

Shutdown Immediate6

New Cold Physical BackUp7

Startup Open8

Page 26: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 26/35

S.C.N. System Change Number

Control fileData files

HeaderRedoRecord

Incremental Time Stamp1

Unique Identified “Committed Version D.B.” 2

Log file

Log file #

Low SCN #

Higth SCN #

Page 27: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 27/35

Oracle Export and Import

Utilities

Logical Backup Methods

• An interactive dialog

• The export page of the Data Manager withinEnterprise Manager

• The command line interface, by specifyingparameters

Page 28: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 28/35

These utilities enable you to do the following:

 –  Archive historical data

 –  Save table definitions (with or without data) to protect

from user error failure –  Move data between machines and databases or versions

of the Oracle server

 –  Transport tablespaces between databases

Page 29: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 29/35

 

Data

BaseExp File *.dmp

ImpData

Base

Formato

Binario

Proprietario

Page 30: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 30/35

Oracle Server

Export Concepts

Generate SQLcommands

Dump file

Two-Taskcommon

(TTC)

Buffercache

SQLcommand

processing

TTCbuffer

Buffercache

manager

Evaluatingbuffer

Analyze blocks

Read blocks

Oracle9i Server

Tables

3Owner

2Full

1IncType Complete1a

IncType Cumulative1b

IncType Incremental1c

Page 31: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 31/35

KEYWORD DESCRIPTION (DEFAULT)

-----------------------------------------------------------------

USERID username/password 

BUFFER  size of data buffer

FILE output files (EXPDAT.DMP)LOG log file of screen output

PARFILE parameter filename

FILESIZE maximum size of each dump file

COMPRESS  import into one extent (Y)

CONSISTENT  cross-table consistency (N)

GRANTS export grants (Y)

INDEXES export indexes (Y)

ROWS export data rows (Y)

CONSTRAINTS export constraints (Y)

TRIGGERS export triggers (Y)

FULL export entire DataBase (N)

OWNER  list of owner usernames

TABLES list of table names

INCTYPE incremental export type

DIRECT direct path (N)

STATISTICS analyze objects (ESTIMATE)

Page 32: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 32/35

Command-Line Method

> exp scott/tiger file=scott.dmp owner=scott grants=Y rows=Y compress=Y

Export Messages

Export: Release 9.2.0.4.0 - Production on Fri Oct 30 09:35:33 1998(c) Copyright 2003 Oracle Corporation. All rights reserved.Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - ProductionWith the Partitioning option

PL/SQL Release 9.2.0.4.0 - ProductionExport done in WE8DEC character set and WE8DEC NCHAR character set. exporting pre-schema procedural objects and actions. exporting foreign function library names for user SCOTT. exporting object type definitions for user SCOTT About to export SCOTT’s objects ... 

. exporting database links

. exporting sequence numbers

. exporting cluster definitions

. about to export SCOTT’s tables via Conventional Path ... 

. . exporting table BONUS 0 rows exported

. . exporting table DEPT 4 rows exported

. . exporting table EMP 14 rows exported

Page 33: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 33/35

IncType Complete

IncType Incremental -----> Exp IncType Generic 

IncType Cumulative  -----> Exp IncType Cumulative or Complete 

Page 34: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 34/35

Oracle Standby

Implementation

• Fail over Solution

• Disaster Recovery Solution (if remote)

• Ease of implementation

• Minimum impact on Production System• Read Only Standby Database

O i f M d O l St db DB

Page 35: 5BackupRecoveryW

8/2/2019 5BackupRecoveryW

http://slidepdf.com/reader/full/5backuprecoveryw 35/35

Overview of Managed Oracle Standby DB

Primary

control file

Primary DB

Primary Instance

Redo log

Arc log

ARCH

Standby DB

DBWR

Standby Instance

Recovery proc

Standby

control file

RFS

Arc log

T.N.S.

Recovery Mode1

ReadOnly Mode2

Activate3