Download
backup and recovery 2 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Backup and Recovery (2) PowerPoint Presentation
Download Presentation
Backup and Recovery (2)

Backup and Recovery (2)

340 Vues Download Presentation
Télécharger la présentation

Backup and Recovery (2)

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Backup and Recovery (2) Oracle 10g Hebah ElGibreen

  2. Outline • Introduction • Backup and Recovery, Why? • Principle of Backup and Recovery • Backup • Recovery • Recovery Commands • Forms of Data Recovery (Choosing the Right Strategy) • Flashback Technology • Flash Recovery Area • Enterprise Manager: • Perform Recovery • Configure Recovery Settings • Practice Hebah ElGibreen

  3. Recovery Commands: Overview • The two most important Recovery Manager commands for repairing a database are RESTOR and RECOVER. • The words restore and recover have specialized technical meanings for the database administrator. • The word restore refers to the operation of replacing a damaged or missing file from a backup copy. • The word recover refers to the process of replaying transactions recorded in the redo logs and making the database usable again. Hebah ElGibreen

  4. Recovery Commands: Overview • When attempts to open a database, Recovery is caused when the database files are not synchronized on shutdown. • After the instance is open, Restore is needed if the instance failed, this happens in case of the loss of: • Any control file • A data file belonging to the system or undo tablespaces. • An entire redo log group. Hebah ElGibreen

  5. SGA Recovery Commands: Instance Recovery Instance • Instance Recovery Phases: • Data files out of sync. • Roll forward (redo). • Committed and noncommitted data in files. • Roll back (undo). • Only committed data in files. Background processes Data file SCN: 140 Control file SCN: 143 Redo log group SCN 74-101 Data file SCN: 129 Control file SCN: 143 Redo log group SCN 102-143 Undo Data file SCN: 99 Database Hebah ElGibreen

  6. Recovery Commands: Restore • Loss of a Control File: If a control file is lost or corrupted, the instance normally aborts, and you must perform the following steps: • Shutdown the instance, if it is still open. • Restore the missing control file by copying an existing control file. • You can copy one of the remaining control files to some other location and update the instances parameter file to point to the new location. • OR, you can delete the reference to the missing control file from the initialization parameter file (Oracle recommends must have at least two control files at all times). • Start the instance. Control files Hebah ElGibreen

  7. Recovery Commands: Restore • Loss of a Redo Log File: If a member of a redo log file group is lost, as long as the group still has at least one member, then: • Determine whether there is a missing log file by examining the alert log. • Restore the missing file by first dropping the lost redo log member. • Then add a new member to replace the lost redo log member. • If the media failure is due to the loss of a disk drive or controller, rename the missing file. • If the group has already been archived, or if you are in NoArchiveLog mode, you may choose to solve the problem by clearing the log group to re-create the missing file or files. Hebah ElGibreen

  8. Recovery Commands: Restore • Loss of a Data File in NOARCHIVELOG Mode: If the database is in NOARCHIVELOG mode, and any data file is lost, perform the following tasks: • Shut down the instance if it is not already down. • Restore the entire database, including all data and control files, from the backup. • Open the database. • Have users reenter all changes made since the last backup. User User User User User Hebah ElGibreen

  9. Recovery Commands: Restore • Loss of a Noncritical Data File in ARCHIVELOG Mode: • With the database in ArchiveLog mode, the loss of any data file not belonging to the SYSTEM or UNDO tablespaces only affects objects that are in the missing file. The rest of the database remains available for users to continue work. • Because the database is in ArchiveLog mode, recovery up to the time of the last commit is possible and users are not required to reenter any data. Users Hebah ElGibreen

  10. Recovery Commands: Restore • Loss of a System-Critical Data File in ARCHIVELOG Mode: If a data file is lost or corrupted, and that file belongs to the SYSTEM or UNDO tablespace: • The instance may or may not shut down automatically. If it does not, use SHUTDOWNABORT to bring the instance down. • Mount the database • Restore and recover the missing data file • Open the database Users Hebah ElGibreen

  11. Forms of Data Recovery (Choosing the Right Strategy) • Datafile Media Recovery. • Complete, Incomplete and Point-In-Time Recovery. • Crash Recovery. Hebah ElGibreen

  12. Forms of Data Recovery (Choosing the Right Strategy) • Datafile Media Recovery: RestoreDatafiles, Apply Redo. • Several situations force you to perform media recovery: • To restore a lost or damaged datafile, SPFILE or control file • To restore a datafile that its changes were recorded in the redo logs but not in this datafile. • For a datafile to be available for media recovery, one of two things must be true: • The database that the datafile belongs to must not be open; • The specific datafile needing recovery must be offline, if the database is open. • A datafile that needs media recovery cannot be brought online until media recovery has been completed. Hebah ElGibreen

  13. Forms of Data Recovery (Choosing the Right Strategy) • Complete, Incomplete and Point-In-Time Recovery. • Occasionally, you need to return a database to its state at a past point in time. • For example, to undo the effect of a user error, such as dropping or deleting the contents of a table, you may want to return the database to its contents before the delete occurred. • Point-in-time recovery is one possible response to a data loss caused by, for instance, a user error or logical corruption that goes unnoticed for some time. • Point-in-time recovery is also your only option if you have to perform a recovery and discover that you are missing an archived log covering time between the backup you are restoring from and the target SCN for the recovery. • Without the missing log, you have no record of the updates to your datafiles during that period. • Your only choice is to recover the database from the point in time of the restored backup, then abandon all changes in or after the missing log. Hebah ElGibreen

  14. Forms of Data Recovery (Choosing the Right Strategy) • Crash Recovery: Automatic Recovery After Instance Failure. • Archived logs are never used during crash recovery, and datafiles are never restored from backup. • It uses only the online redo log files and current online datafiles. • There are a number of important differences between the crash and media recovery: • Media recovery must be explicitly invoked by a user. • Media recovery applies needed changes to datafiles that have been restored from backup, not to online datafiles left over after a crash. • Media recovery must use archived logs as well as the online logs, to find changes reaching back to the time of the datafile backup. Hebah ElGibreen

  15. Flashback Technology • Oracle Flashback Technology is an alternatives to Point-in-Time Recovery. • Oracle Flashback Technology provides a set of features that provide useful alternatives to support • Viewing past states of data, • Winding data back and forth in time, without requiring you to restore large portions of your database from backup or perform point-in-time recovery. Hebah ElGibreen

  16. Flash Recovery Area • The flash recovery area is a space set aside on the disk to contain archived logs, backups, flashback logs, mirrored control files, and mirrored redo logs. • Flash recovery area automates management of backup-related files. • Using a flash recovery area minimizes the need to manually manage disk space for your backup-related files and balance the use of space among the different types of files. • Monitor the flash recovery area to: • Configure flashback logging. • Size the recovery area. • View current space consumption. Hebah ElGibreen

  17. Enterprise Manager Oracle 10g… Perform Recovery Configure Recovery Settings Hebah ElGibreen

  18. References • “Beginning Oracle Database 11g Administration: From Novice to Professional”, By Iggy Fernandez, Apress. • Backup and Recovery Basics 10g Release 2, By Antonio Romero, Lance Ashdown, Oracle® Database, 2005. • Oracle Database 10g: Administration Workshop I, student guide. Hebah ElGibreen