Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.

Slides:



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

Chapter 14 Handling Online Redo Log Failures. Background RMAN doesn’t back up online redo logs You don’t use RMAN to recover from online redo log failures.
ITEC474 Control File Maintenance
1 Chapter 15 Duplicating Databases and Transporting Data.
1 Getting The Most Out of RMAN By: Charles Pfeiffer CIO, Remote Control DBA (888)
Harvard University Oracle Database Administration Session 10 Database Backups.
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
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.
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
Chapter 5 Configuring the RMAN Environment. Objectives Show command to see existing settings Configure command to change settings Backing up the controlfile.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
CHAPTER 17 Configuring RMAN. Introduction to RMAN RMAN was introduced in Oracle 8.0. RMAN is Oracle’s tool for backup and recovery. RMAN is much more.
Oracle9i Database Administrator: Implementation and Administration
The Oracle Recovery Manager (RMAN)
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
CHAPTER 18 RMAN Backups and Reporting. Introduction to RMAN Backups and Reporting The focus of this chapter is backups of: Datafiles Control files Archived.
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.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
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.
Backup & Recovery Backup and Recovery Strategies on Windows Server 2003.
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.
A Guide to Oracle9i1 Database Instance startup and shutdown.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
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.
IT Database Administration SECTION 01. Starting Up and Shutting Down the Database Database Administration Facilities – A number of tools are available.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
IT Database Administration Section 09. Backup and Recovery Backup: The available options Full Consistent (cold) Backup Database shutdown, all files.
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.
© 2006 Northgate Information Solutions plc and its associated companies. All rights reserved. Slide 1.
Backup and Recovery Part 2. Online backup Online backup requirements: Backup all data files (file system copy) Backup all redo information produced during.
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 © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
What is the Flashback Database? Improves a database’s availability Useful alternative to traditional restoration methods Contains Flashback logs Archived.
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.
Control File Information The database name The timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace.
3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.
Recovery Catalog Creation and Maintenance
Oracle9i Database Administrator: Implementation and Administration
Performing Tablespace Point-in-Time Recovery
Performing Tablespace Point-in-Time Recovery
Duplicating a Database
Performing User-Managed Backup and Recovery
Performing Database Recovery
Chapter 5 The Redo Log Files.
Presentation transcript:

Chapter 12 Performing Incomplete Recovery

Background Viewed as one of the more difficult chapters to write Thought it was important to put in material such as restoring to a previous incarnation and restoring a subset of datafiles Debated on how much information to put in on TSPITR, decided to go with one automated example

Incomplete Recovery Incomplete recovery in Oracle means that you do not recover all transactions that were committed at the time of the failure Usually performed because you don’t have all redo required to perform complete recovery Also performed sometimes on purpose due to a user error (like erroneously deleted data)

Three Methods for Initiating Incomplete Recovery Using RMAN restore database until restore tablespace until flashback database Restore database until is the main focus of this chapter

Four Types of RMAN Incomplete Recovery Commands Time Change (sometimes called system change number [SCN]) Log sequence number Restore point (Oracle Database 10g Release 2 and newer versions)

Determining the Type of Incomplete Recovery to Perform You know approximately what time you want to stop the recovery You know the particular log file for which you want to stop the recovery process You know the SCN at which you want to end the recovery process You want to restore to a defined restore point You want to restore one tablespace to a point in time You want to restore and recover a subset of your database’s datafiles You have enabled the flashback database feature and want to flashback your database.

Consider Alternatives to Incomplete Recovery Flashback drop Flashback table or Flashback query to restore and recover an erroneously dropped table or deleted data

Performing Time Based Incomplete Recovery Specify the time as part of the restore and recover commands Use the set until time command, and then issue unqualified restore and recover commands

Performing Time Based Incomplete Recovery connect target / RMAN> startup mount; RMAN> run{ RMAN> set until time "to_date('05-oct :00:00', 'dd-mon-rrrr hh24:mi:ss')"; RMAN> restore database; RMAN> recover database; RMAN> } RMAN> alter database open resetlogs;

Performing Log Sequenced Based Incomplete Recovery connect target / RMAN> startup mount; RMAN> restore database until sequence 50; RMAN> recover database until sequence 50; RMAN> alter database open resetlogs; Do you have to open the database with resetlogs?

Performing Log Sequenced Based Recovery RMAN> connect target / RMAN> startup mount; RMAN> run{ 2> set until sequence 125 thread 1; 3> restore database; 4> recover database; 5> } RMAN> alter database open resetlogs;

Performing Cancel Based Recovery Use RMAN to restore datafiles Get out of RMAN to perform the recovery portion, use SQL*Plus Why would a DBA want to use SQL*Plus instead of RMAN? Very similar to log sequence based recovery

Performing Cancel Based Recovery RMAN> connect target / RMAN> startup mount; RMAN> restore database; # restore database from last backup Once your database is restored, you can start a SQL*Plus session and initiate a cancel based recovery, as shown here: SQL> connect / as sysdba SQL> recover database until cancel;

Using Log-Miner to find an SCN 1. Specify a set of archived redo log files for LogMiner to analyze. 2. Start LogMiner, and specify a data dictionary. 3. Perform analysis. 4. Stop the LogMiner session.

Performing Change or SCN Based Recovery RMAN> connect target / RMAN> startup mount; RMAN> restore database until scn 950; RMAN> recover database until scn 950; RMAN> alter database open resetlogs;

Performing Change or SCN Based Recovery RMAN> connect target / RMAN> startup mount; RMAN> run{ 2> set until scn 950; 3> restore database; 4> recover database; 5> } RMAN> alter database open resetlogs;

Recovering to a Restore Point New feature with Oracle Database 10g or higher RMAN> connect target / RMAN> startup mount; RMAN> restore database until restore point MY_RP; RMAN> recover database until restore point MY_RP; RMAN> alter database open resetlogs;

Restoring a Non-Archivelog Mode Database You can use RMAN to backup up a non-archivelog mode database Database must be in mount mode when backing up a non-archivelog mode database You can use that backup to restore the database back to the point in time that it was backed up There is no roll forward because there are no archive redo logs to apply

Restoring a Non-Archive redo log database RMAN> connect target / RMAN> startup nomount; RMAN> restore controlfile from autobackup; RMAN> alter database mount; RMAN> restore database; RMAN> alter database open resetlogs;

Recovering to a Previous Incarnation In 9i and lower, this used to be a difficult task Oracle Support would often be called for assistance When a database is opened with the resetlogs command, a new incarnation of the database is created What if you want to restore to a point prior to a resetlogs?

Restoring and Recovering to a Previous Incarnation of the Database RMAN> connect target / RMAN> startup nomount; RMAN> restore controlfile from autobackup until time 2> "to_date('03-sep :00:00', 'dd-mon- rrrr hh24:mi:ss')"; RMAN> alter database mount; RMAN> list incarnation of database;

Restoring and Recovering to a Previous Incarnation of the Database RMAN> restore database until time 2> "to_date('03-sep :00:00', 'dd-mon-rrrr hh24:mi:ss')"; RMAN> recover database until time 2> "to_date('03-sep :00:00', 'dd-mon-rrrr hh24:mi:ss')"; RMAN> alter database open resetlogs; Note: page 376, that should say “resetlogs” one word not “reset logs”

Performing Tablespace Point in Time Recovery 1. Determine and resolve any dependencies to objects in tablespaces not included in the TSPITR 2. Determine whether there are objects that will not be recovered 3. Create a destination on disk to temporarily hold the auxiliary database 4. Run the recover tablespace until command 5. Back up the restored tablespace and alter it online

RMAN Automates TSPITR 1. Creates an auxiliary instance, starts it, and connects to it 2. Takes offline tablespaces that are involved with TSPITR 3. Restores the backup control file that corresponds to the target restore time 4. Restores datafiles to a destination specified by your AUXILIARY DESTINATION 5. Recovers restored datafiles in an auxiliary location 6. Opens an auxiliary database with the open resetlogs command 7. Exports the auxiliary data dictionary metadata about recovered tablespaces and shuts down the auxiliary database 8. Issues a switch command on the target database to update the control file to point at the recovered auxiliary datafiles 9. Imports objects associated with recovered tablespaces into the target database 10. Deletes the auxiliary datafiles

Recovering a Subset of Datafiles What if you only want to perform an incomplete recovery on a subset of datafiles? When performing incomplete recovery, you must perform recovery on all online datafiles Any datafiles that you don’t want to recover must be taken offline first

Incomplete Recovery on a Subset of Datafiles RMAN> connect target / RMAN> startup mount; RMAN> sql 'alter database datafile 7, 8, 9 offline for drop'; RMAN> restore database until SCN ; RMAN> recover database until SCN ; RMAN> alter database open resetlogs;

Troubleshooting Incomplete Recovery Ensure you follow the correct sequence of events Ensure the same point is used 1. restore database until ; 2. recover database until ; 3. alter database open resetlogs;

Ensure Datafile SCNs are Aligned select file#, status, checkpoint_change#, to_char(checkpoint_time,'dd-mon- rrrrhh24:mi:ss') from v$datafile_header;