12 Copyright © Oracle Corporation, 2002. All rights reserved. User-Managed Complete Recovery.

Slides:



Advertisements
Similar presentations
17 Copyright © 2005, Oracle. All rights reserved. Performing Flashback.
Advertisements

Oracle Architecture. Instances and Databases (1/2)
ITEC474 Control File Maintenance
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
Advanced Databases DBA: Backups 1. Advanced Databases Agenda Define backup Discuss Backup Terminology Explain various backup and restore options in Oracle.
Database Backup and Recovery
RMAN Restore and Recovery
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Harvard University Oracle Database Administration Session 11 Database Recovery.
Database Backup & Recovery David Konopnicki. Introduction A major responsibility of the database administrator is to prepare for the possibility of hardware,
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.
Oracle9i Database Administrator: Implementation and Administration
7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
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.
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.
5 Copyright © 2004, Oracle. All rights reserved. Controlling the Database.
15 Copyright © 2007, Oracle. All rights reserved. Performing Database Backups.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Backup and Recovery Overview Supinfo Oracle Lab. 6.
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.
8 Copyright © Oracle Corporation, All rights reserved. Configuring the Database Archiving Mode.
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.
Instance and Media Recovery Structures Supinfo Oracle Lab. 7.
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.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
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 © 2004, Oracle. All rights reserved. Creating an Oracle Database.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © Oracle Corporation, All rights reserved. Backup and Recovery Overview.
19 Copyright © 2004, Oracle. All rights reserved. Database Backups.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
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.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
RMAN Maintenance.
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:

12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery

12-2 Copyright © Oracle Corporation, All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe media recovery Perform recovery in NOARCHIVELOG mode Perform complete recovery in ARCHIVELOG mode Restore datafiles to different locations Relocate and recover a tablespace by using archived redo log files Describe read-only tablespace recovery

12-3 Copyright © Oracle Corporation, All rights reserved. Media Recovery Used to recover a lost or damaged current datafile or control file Requires explicit invocation Operates as follows: –Files are restored from backups –Redo data is applied to the restored files from archived redo log files and online redo logs

12-4 Copyright © Oracle Corporation, All rights reserved. Recovery Steps Restored datafiles Database containing committed and uncommitted transactions Recovered database Redo appliedUndo applied Datafile 1 Datafile 2 Datafile 3 Datafile 1 Datafile 2 Datafile 3 Datafile 1 Datafile 2 Datafile 3 Archived Redo log Online Redo log

12-5 Copyright © Oracle Corporation, All rights reserved. Restoration and Datafile Media Recovery with User-Managed Procedures Restore files using operating system commands Recover files using the SQL*Plus RECOVER command

12-6 Copyright © Oracle Corporation, All rights reserved. ARCHIVELOG and NOARCHIVELOG Modes Instance SGA Redo log buffer Data buffer Large PoolJava Pool Shared pool Data dict. cache Shared SQL and PL/SQL PMON DBWnSMON LGWRCKPTARCn User process Server process PGA User process Server process PGA Password File Parameter File Database 144 Datafile Datafile Datafile Control files 144 Redo log file Redo log file 2

12-7 Copyright © Oracle Corporation, All rights reserved. Recovery in NOARCHIVELOG Mode In NOARCHIVELOG mode, you must restore the following database files: –All datafiles –Control files You can also restore the following files: –Redo log files –Password file –Parameter file

12-8 Copyright © Oracle Corporation, All rights reserved. Recovery in NOARCHIVELOG Mode Advantages –Easy to perform, with low risk of error –Recovery time is the time it takes to restore all files Disadvantages –Data is lost and must be reapplied manually –The entire database is restored to the point of the last whole closed backup

12-9 Copyright © Oracle Corporation, All rights reserved. Recovery in NOARCHIVELOG Mode with Redo Log File Backups Restore from the most recent backup Password File Parameter File Password File Parameter File Password File Parameter File Backup 144 Datafile Datafile Datafile Control files 144 Redo log file Redo log file 2 Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 Database 144 Datafile Datafile Datafile Control files 144 Redo log file Redo log file 2

12-10 Copyright © Oracle Corporation, All rights reserved. Recovery in NOARCHIVELOG Mode Without Redo Log File Backups 1.Shut down the instance. 2.Restore the datafiles and the control file from the most recent whole database backup. 3.Perform cancel-based recovery. 4.Open the database with the RESETLOGS option.

12-11 Copyright © Oracle Corporation, All rights reserved. Recovery in ARCHIVELOG Mode Complete Recovery –Uses redo data or incremental backups –Updates the database to the most current point in time –Applies all redo changes Incomplete Recovery –Uses backup and redo logs to produce a noncurrent version of the database

12-12 Copyright © Oracle Corporation, All rights reserved. Complete Recovery Make sure that datafiles for restore are offline. Restore only lost or damaged datafiles. Do not restore the control files, redo log files, password files, or parameter files. Recover the datafiles.

12-13 Copyright © Oracle Corporation, All rights reserved. Complete Recovery in ARCHIVELOG Mode Advantages –Only need to restore lost files –Recovers all data to the time of failure –Recovery time is the time it takes to restore lost files and apply all archived log files Disadvantages –Must have all archived log files since the backup from which you are restoring

12-14 Copyright © Oracle Corporation, All rights reserved. Determining Which Files Need Recovery View V$RECOVER_FILE to determine which datafiles need recovery. View V$ARCHIVED_LOG for a list of all archived redo log files for the database. View V$RECOVERY_LOG for a list of all archived redo log files required for recovery.

12-15 Copyright © Oracle Corporation, All rights reserved.

12-16 Copyright © Oracle Corporation, All rights reserved. User-Managed Recovery Procedures: RECOVER Command Recover a mounted database: Recover an open database: SQL> RECOVER DATABASE SQL> RECOVER TABLESPACE users SQL> RECOVER DATAFILE 2> '/ORADATA/u03/users01.dbf' Or SQL> RECOVER DATAFILE 2> '/ORADATA/u03/users01.dbf' Or

12-17 Copyright © Oracle Corporation, All rights reserved. Using Archived Redo Log Files During Recovery To change archive location, use the ALTER SYSTEM ARCHIVE LOG... command. To apply redo log files automatically: –Issue the SET AUTORECOVERY ON command before starting media recovery. –Enter auto when prompted for an archived log file. –Use the RECOVER AUTOMATIC... command.

12-18 Copyright © Oracle Corporation, All rights reserved.

12-19 Copyright © Oracle Corporation, All rights reserved. Restoring Datafiles to a New Location with User-Managed Procedures Use operating system commands to restore the datafile to the new location. Use the ALTER DATABASE RENAME FILE command to record the change in the control file.

12-20 Copyright © Oracle Corporation, All rights reserved. Complete Recovery Methods Closed database recovery for: –System datafiles –Undo segment datafiles –Whole database Open database recovery, with database initially opened (for file loss) Open database recovery with database initially closed (for hardware failure) Data file recovery with no datafile backup

12-21 Copyright © Oracle Corporation, All rights reserved.

12-22 Copyright © Oracle Corporation, All rights reserved. Complete Recovery of a Closed Database Closed database recovery is used for: System tablespace datafiles Rollback segment datafiles Whole database

12-23 Copyright © Oracle Corporation, All rights reserved. Shut down the instance 1 Closed Database Recovery: Example Restore datafile 1 (Log Sequence 144) 2 Open the database 4 Mounted Database Recovered Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 Closed Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file Datafile Datafile Datafile Redo log file Redo log file Control files 3 3 Archived log file 144

12-24 Copyright © Oracle Corporation, All rights reserved.

12-25 Copyright © Oracle Corporation, All rights reserved. Open Database Recovery When the Database Is Initially Open Use this method when: The database is currently open The database will remain open during the recovery The media failure does not affect the SYSTEM tablespace

12-26 Copyright © Oracle Corporation, All rights reserved. 1 Open Database Recovery: Example Take datafile 2 offline Restore datafile 2 (Log Sequence 144) Bring datafile 2 online Open Database Archived log file 144 Recovered Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 Open Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file Datafile Datafile Datafile Redo log file Redo log file Control files 3

12-27 Copyright © Oracle Corporation, All rights reserved.

12-28 Copyright © Oracle Corporation, All rights reserved. Open Database Recovery When the Database Is Initially Closed Use this method when: The database is currently closed The database will be opened during recovery The media failure does not affect the SYSTEM tablespace

12-29 Copyright © Oracle Corporation, All rights reserved. Take datafile 2 offline 2 Open Database Recovery: Example Restore datafile 2 4 Bring datafile 2 online 6 1 Mount the database 3 Open the database 5 Open Database Archived log file 144 Recovered Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 Closed Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 5 5

12-30 Copyright © Oracle Corporation, All rights reserved.

12-31 Copyright © Oracle Corporation, All rights reserved. Recovery of a Datafile Without a Backup Datafile is lost that was never backed up Cannot be used when it is a file from the SYSTEM tablespace Cannot be used if the control file has been recreated

12-32 Copyright © Oracle Corporation, All rights reserved. Re-Creating Lost Datafiles Without Backup Used when missing datafile cannot be restored because it had never been backed up. Description of missing datafile is still in data dictionary and control file. Re-create the datafile: Re-create the datafile with a different filename: SQL> ALTER DATABASE CREATE DATAFILE 'filename'; SQL> ALTER DATABASE CREATE DATAFILE 'filename' AS 'new file name';

12-33 Copyright © Oracle Corporation, All rights reserved. Open Database Recovery without a Backup: Example Bring the datafile or tablespace online 4 1 Take the datafile or tablespace offline 2 Re-create the datafile 3 Archived log file 144 Recovered Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file 2 Open Database 146 Datafile Datafile Datafile Control files 146 Redo log file Redo log file Datafile Datafile Datafile Datafile Datafile 3 Datafile Control files 146 Redo log file Redo log file 2 3 3

12-34 Copyright © Oracle Corporation, All rights reserved.

12-35 Copyright © Oracle Corporation, All rights reserved. Read-Only Tablespace Recovery Backup 2 Recovery Case 1 Case 2 Case 3 Backup 1 Read-Only Read-WriteRead-Only Read-Write

12-36 Copyright © Oracle Corporation, All rights reserved. Read-Only Tablespace Recovery Issues Special considerations must be taken for read-only tablespaces when: Re-creating a control file Renaming datafiles Using a backup control file

12-37 Copyright © Oracle Corporation, All rights reserved. Loss of Control Files You may need to create control files if: All control files are lost because of a failure The name of a database needs to be changed The current settings in the control file need to be changed

12-38 Copyright © Oracle Corporation, All rights reserved. Recovering Control Files Methods to recover from loss of control file: Use the current control file Create a new control file Use a backup control file

12-39 Copyright © Oracle Corporation, All rights reserved. Summary In this lesson, you should have learned how to: Determine what type of recovery is required Determine which files need to be restored and recovered Recover a database in NOARCHIVELOG mode Recover a database in ARCHIVELOG mode Restore datafiles to different locations if the original location is unavailable

12-40 Copyright © Oracle Corporation, All rights reserved. Practice 12 Overview These practices cover the following topics: Performing complete database recovery with the database in NOARCHIVELOG mode Performing complete database recovery with the database in ARCHIVELOG mode

12-41 Copyright © Oracle Corporation, All rights reserved. Practice 12-1

12-42 Copyright © Oracle Corporation, All rights reserved. Practice 12-2

12-43 Copyright © Oracle Corporation, All rights reserved. Practice 12-3

12-44 Copyright © Oracle Corporation, All rights reserved. Practice 12-4

12-45 Copyright © Oracle Corporation, All rights reserved. Practice 12-5

12-46 Copyright © Oracle Corporation, All rights reserved.