5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
Advertisements

17 Copyright © 2005, Oracle. All rights reserved. Performing Flashback.
ITEC474 Control File Maintenance
Database Backup and Recovery
RMAN Restore and Recovery
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
Harvard University Oracle Database Administration Session 11 Database Recovery.
Chapter 5Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 5 User-Managed Incomplete Recovery.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
Configuring Recovery Manager
4 Copyright © 2008, Oracle. All rights reserved. Configuring Backup Specifications.
Chapter 5 Configuring the RMAN Environment. Objectives Show command to see existing settings Configure command to change settings Backing up the controlfile.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
Oracle9i Database Administrator: Implementation and Administration
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
5 Copyright © 2004, Oracle. All rights reserved. Using Recovery Manager.
5 Copyright © 2008, Oracle. All rights reserved. Using RMAN to Create Backups.
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.
15 Copyright © 2005, Oracle. All rights reserved. Performing Database Backups.
Backup & Recovery Backup and Recovery Strategies on Windows Server 2003.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
4 Copyright © 2006, Oracle. All rights reserved. Recovering from Noncritical Losses.
15 Copyright © 2007, Oracle. All rights reserved. Performing Database Backups.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
7 Copyright © 2004, Oracle. All rights reserved. Recovering from Noncritical Losses.
Chapter 8Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 8 Complete Recovery with Recovery Manager.
6 Copyright © 2006, Oracle. All rights reserved. Flashback.
15 Copyright © Oracle Corporation, All rights reserved. RMAN Incomplete Recovery.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
2 Copyright © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
16 Copyright © 2005, Oracle. All rights reserved. Performing Database Recovery.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
3 Copyright © 2007, Oracle. All rights reserved. Using the RMAN Recovery Catalog.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
19 Copyright © 2004, Oracle. All rights reserved. Database Backups.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
What is Flashback? Technology that allows you to revert the database to a point in time in the past Several versions of flashback available Different types.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
23 Copyright © 2004, Oracle. All rights reserved. Preferring the Past: Flashback.
Control File Information The database name The timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace.
RMAN Maintenance.
Oracle9i Database Administrator: Implementation and Administration
Database Recovery.
Performing User-Managed Backup and Recovery
Performing Database Recovery
Chapter 5 The Redo Log Files.
Presentation transcript:

5 Copyright © 2006, Oracle. All rights reserved. Database Recovery

5-2 Copyright © 2006, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to: Perform complete or incomplete user-managed recovery Identify situations where incomplete recovery is necessary Perform complete or incomplete recovery by using RMAN Perform incomplete recovery based on time, SCN, log sequence, restore points, or the cancel method Recover an automatically backed up control file Use Enterprise Manage to perform recovery Recover read-only tablespaces User man. RMAN CLI EM Complete Incomplete Control file RO TBS

5-3 Copyright © 2006, Oracle. All rights reserved. Recovery Methods There are two methods for performing recovery: User-managed recovery –Files must be maintained and moved into place manually. –Use SQL*Plus commands. RMAN recovery –Files are managed automatically. –Use RMAN functionality including all repository maintenance and reporting capabilities. –This can be done by using Enterprise Manager. –Oracle Corporation recommends using this method.

5-4 Copyright © 2006, Oracle. All rights reserved. User-Managed Recovery: RECOVER Command Restore all database files from a backup and then recover the database: Restore the damaged data files from a backup and then recover the data files: Or: SQL> RECOVER DATABASE SQL> RECOVER TABLESPACE index_tbs SQL> RECOVER DATAFILE 2> '/oradata/indx01.dbf'

5-5 Copyright © 2006, Oracle. All rights reserved. RMAN Recovery: RESTORE and RECOVER Commands run{ sql "ALTER TABLESPACE inv_tbs OFFLINE IMMEDIATE"; RESTORE TABLESPACE inv_tbs; RECOVER TABLESPACE inv_tbs DELETE ARCHIVELOG; sql "ALTER TABLESPACE inv_tbs ONLINE"; } User man. >RMAN CLI EM Complete Incomplete Control file RO TBS

5-6 Copyright © 2006, Oracle. All rights reserved. Recovery Using Enterprise Manager With the Enterprise Manager Recovery Wizard, you can create and run an RMAN script to perform the recovery. RMAN> RECOVER DATABASE … User man. RMAN CLI >EM Complete Incomplete Control file RO TBS

5-7 Copyright © 2006, Oracle. All rights reserved. Complete Versus Incomplete Recovery There are two types of recovery: Complete recovery brings the database up to the present, including all data changes made to the point in time when the recovery was requested. Incomplete recovery brings the database up to a specified point in time in the past, before the recovery operation was requested. Recovery task started at this time Complete recovery Incomplete recovery Missing transactions after incomplete recovery Restore from this backup

5-8 Copyright © 2006, Oracle. All rights reserved. Complete Recovery Restored data files Data files containing committed and uncommitted transactions Recovered data files Changes applied Undo applied Archived log Online Redo log User man. RMAN CLI EM >Complete Incomplete Control file RO TBS 4 Database opened

5-9 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery Data files containing committed and uncommitted Transactions up to PIT PIT-recovered data files Undo applied Archived log Online Redo log 4 Database opened X X Changes applied to point in time (PIT) Restored data files from as far back as necessary User man. RMAN CLI EM Complete >Incomplete Control file RO TBS

5-10 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery (notes only slide)

5-11 Copyright © 2006, Oracle. All rights reserved. Situations Requiring Incomplete Recovery Complete recovery fails because of a missing archived log file. One or more unarchived redo log files and a data file are lost. A backup of the control file is used to open or recover the database.

5-12 Copyright © 2006, Oracle. All rights reserved. Types of Incomplete Recovery There are four types of incomplete recovery: Time-based recovery Cancel-based recovery Change-based recovery Log sequence recovery

5-13 Copyright © 2006, Oracle. All rights reserved. Types of Incomplete Recovery (notes only slide)

5-14 Copyright © 2006, Oracle. All rights reserved. Performing User-Managed Incomplete Recovery Recover a database until time: Recover a database until cancel: Recover using the backup control file: SQL> RECOVER DATABASE UNTIL CANCEL; SQL> RECOVER DATABASE UNTIL 2 TIME ' :12:10:03'; SQL> RECOVER DATABASE 2 UNTIL TIME ' :12:10:03' 3 USING BACKUP CONTROLFILE;

5-15 Copyright © 2006, Oracle. All rights reserved. Performing User-Managed Incomplete Recovery To perform user-managed incomplete recovery, follow these steps: 1.Shut down the database. 2.Restore data files. 3.Mount the database. 4.Recover the database. 5.Open the database with the RESETLOGS option.

5-16 Copyright © 2006, Oracle. All rights reserved. User-Managed Time-Based Recovery: Example SQL> SHUTDOWN IMMEDIATE $ cp /BACKUP/* /u01/db01/ORADATA SQL> STARTUP MOUNT SQL> RECOVER DATABASE UNTIL TIME ' :11:44:00'; SQL> ALTER DATABASE OPEN RESETLOGS; This is the scenario: A job ran in error, and its effects have to be undone. This happened 15 minutes ago, and there has been little database activity since then. You decide to perform incomplete recovery to restore the database back to its state as of 15 minutes ago.

5-17 Copyright © 2006, Oracle. All rights reserved. User-Managed Time-Based Recovery Steps (notes only slide)

5-18 Copyright © 2006, Oracle. All rights reserved. User-Managed Cancel-Based Recovery: Example The scenario is the same as the one for the time-based example, except for these findings: Redo logs are not multiplexed. One of the online redo logs is missing. The missing redo log is not archived. The redo log contained information from 11:34 a.m. Twenty-six minutes of data are lost. Users can reenter their data manually.

5-19 Copyright © 2006, Oracle. All rights reserved. User-Managed Cancel-Based Recovery: Example Recover the database as follows: 1.Shut down the database. 2.Restore all data files from the most recent backup. 3.You already have a valid backup, so mount the database. 4.Execute RECOVER DATABASE UNTIL CANCEL. 5.Execute ALTER DATABASE OPEN RESETLOGS to open the database.

5-20 Copyright © 2006, Oracle. All rights reserved. Performing Incomplete Recovery by Using RMAN 1.Mount the database. 2.Allocate multiple channels for parallelization. 3.Restore all data files. 4.Recover the database by using UNTIL TIME, UNTIL SEQUENCE, or UNTIL SCN. 5.Open the database by using RESETLOGS.

5-21 Copyright © 2006, Oracle. All rights reserved. Time-Based Recovery Using RMAN: Example RMAN> RUN { 2> SET UNTIL TIME = ' :11:44:00'; 3> RESTORE DATABASE; 4> RECOVER DATABASE; 5> ALTER DATABASE OPEN RESETLOGS; }

5-22 Copyright © 2006, Oracle. All rights reserved. Time-Based Recovery Using RMAN: Example (notes only slide)

5-23 Copyright © 2006, Oracle. All rights reserved. Log Sequence Recovery Using RMAN: Example RMAN> RUN { 2> SET UNTIL SEQUENCE 120 THREAD 1; 3> ALTER DATABASE MOUNT; 4> RESTORE DATABASE; 5> RECOVER DATABASE; # recovers through log 119 6> ALTER DATABASE OPEN RESETLOGS; 7> }

5-24 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery Using Enterprise Manager

5-25 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery and the Alert Log The following are some best practices regarding the alert log in incomplete recovery scenarios: Check the alert log before and after recovery. Look for error information, hints, and SCNs. Confirm that steps in the recovery process were successful.

5-26 Copyright © 2006, Oracle. All rights reserved. Restore Points A restore point: Serves as an alias for an SCN or a specific point in time Is stored in the control file Can be used with: – RECOVER DATABASE – FLASHBACK DATABASE – FLASHBACK TABLE SQL> CREATE RESTORE POINT before_load; before_load RMAN> RECOVER DATABASE UNTIL RESTORE POINT before_load; 2 1

5-27 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery: Best Practices Plan for and practice scenarios ahead of time. Investigate and verify that incomplete recovery is necessary. Follow all steps carefully. Take whole database backups before and after recovery. Always verify that the recovery was successful. Take advantage of restore points.

5-28 Copyright © 2006, Oracle. All rights reserved. Incomplete Recovery Best Practices (notes only slide)

5-29 Copyright © 2006, Oracle. All rights reserved. Recovering a Control File Autobackup Recovery Manager (RMAN) Flash recovery area Database Control file RECOVER DATABASE; ALTER DATABASE OPEN RESETLOGS; ALTER TABLESPACE temp ADD TEMPFILE...; RMAN> RESTORE CONTROLFILE TO 2> '/oradata/ctlfile.bak' FROM AUTOBACKUP; User man. RMAN CLI EM Complete Incomplete >Control file RO TBS

5-30 Copyright © 2006, Oracle. All rights reserved. Recovering a Control File Autobackup (notes only slide)

5-31 Copyright © 2006, Oracle. All rights reserved. Creating a New Control File SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE; Password file Parameter file SYSTEM SYSAUX UNDO TEMP USERS INDEX Redo log file 1B Redo log file 1A Redo log file 2B Redo log file 2A Control files

5-32 Copyright © 2006, Oracle. All rights reserved. Creating a New Control File

5-33 Copyright © 2006, Oracle. All rights reserved. Recovering Read-Only Tablespaces Change Tablespace State Crash and perform recovery Case 1 Case 2 Case 3 Backup Read-only Read/write Read-only Read/write * * * * Control file backup to be used for recovery if current one lost User man. RMAN CLI EM Complete Incomplete Control file >RO TBS

5-34 Copyright © 2006, Oracle. All rights reserved. Recovering Read-Only Tablespaces (notes only slide)

5-35 Copyright © 2006, Oracle. All rights reserved. Read-Only Tablespace Recovery Issues Special considerations must be taken for read-only tablespaces when: Re-creating a control file Renaming data files Using a backup control file

5-36 Copyright © 2006, Oracle. All rights reserved. Read-Only Tablespace Recovery Issues (notes only slide)

5-37 Copyright © 2006, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Perform complete or incomplete user-managed recovery Perform complete or incomplete recovery by using RMAN Identify situations where incomplete recovery is necessary Perform incomplete recovery based on time, SCN, log sequence, restore points, or the cancel method Recover a control file autobackup Use Enterprise Manage to perform recovery Recover read-only tablespaces

5-38 Copyright © 2006, Oracle. All rights reserved. Practice Overview: Performing Incomplete Recovery This practice covers the following topics: Point-in-time recovery using RMAN Recovery from the loss of control files