Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material."— Presentation transcript:

1 Chapter 12 Performing Incomplete Recovery

2 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

3 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)

4 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

5 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)

6 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.

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

8 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

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

10 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?

11 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;

12 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

13 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;

14 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.

15 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;

16 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;

17 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;

18 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

19 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;

20 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?

21 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-2006 00:00:00', 'dd-mon- rrrr hh24:mi:ss')"; RMAN> alter database mount; RMAN> list incarnation of database;

22 Restoring and Recovering to a Previous Incarnation of the Database RMAN> restore database until time 2> "to_date('03-sep-2006 00:00:00', 'dd-mon-rrrr hh24:mi:ss')"; RMAN> recover database until time 2> "to_date('03-sep-2006 00: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”

23 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

24 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

25 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

26 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 314159; RMAN> recover database until SCN 314159; RMAN> alter database open resetlogs;

27 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;

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


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

Similar presentations


Ads by Google