Recovery with Archiving  «Prev  Next»

Lesson 3 Listing the different methods of recovery
Objective Explain how the recovery depends on the state of the database.

Listing the Different Recovery Methods in Oracle

When you perform a complete recovery, you need to choose a recovery method based on the state of your database, and this depends on which files are damaged. There are four different methods for complete recovery. The following table describes the situations when a specific method should be applied.

RECOVERY METHOD FILES NEEDING RECOVERY RECOMMENDED USE
Closed Database The damaged files belong to the SYSTEM or a rollback segment tablespace The whole database, or a majority of the datafiles, if damaged The database does not have to be running at all times--24 hours per day, 7 days per week.
Open Database, initially open Damaged files that do not belong to the SYSTEM or rollback segment tablespaces The database is a 24x7, and you have to keep the down-time of the database to a minimum While the database is running, a media failure or a file corruption occurs, or there is an accidental loss of file/s
Open Database, initially closed The damaged files do not belong to the SYSTEM or rollback segment tablespaces A media failure or a hardware crash has shut down the system The database is 24 and 7, and you have to keep the down-time of the database to a minimum
Recovering a datafile with no backup (This method is covered in a later module.) The damaged files do not belong to the SYSTEM or rollback segment tablespaces A media failure or user failure occurs and results in the loss of a datafile that was never backed up or is too new to have been picked up by a scheduled backup All archived logs are available since the file was created

During recovery, all the required archived log files must be located on a disk that Oracle can access. If you store these files on a tape to save disk space, you must restore these files to the disk before recovery starts.
In Oracle 12c, the type of database recovery you perform is intricately linked to the state of the database at the time of failure or when the need for recovery is identified. Understanding this relationship is crucial for a Database Administrator (DBA) to execute the most appropriate recovery strategy. There are primarily three scenarios to consider: when the database is open, when it is closed, and when it has experienced a media failure. Here's how the type of recovery varies in each scenario:
  1. Database Open and Online (Instance Recovery):
    • When the database is open, and an instance failure occurs (such as a server crash or power failure), Oracle automatically performs instance recovery upon restart.
    • In this scenario, the database uses the online redo logs to replay changes made since the last checkpoint. This process, which typically happens quickly and automatically, is known as instance or crash recovery.
    • The key here is that the datafiles are intact, and only the in-memory data and transactions that were not yet written to disk need recovery.
  2. Database Closed Normally (No Recovery or Complete Recovery):
    • If the database was closed normally (using `SHUTDOWN NORMAL` or `SHUTDOWN IMMEDIATE`), no recovery is needed upon restart since all transactions were committed and buffers were written to disk.
    • However, if after a normal shutdown, datafile corruption or loss is detected (perhaps identified through backup validations or other checks), a complete recovery may be needed.
    • Complete recovery in this case involves restoring datafiles from backups and applying all archived redo logs up to the point of failure or to the last available log. This is feasible only if the database is running in ARCHIVELOG mode.
  3. Database Experiences Media Failure (Complete Recovery or Incomplete Recovery):
    • Media failure refers to the loss or corruption of datafiles, control files, or redo log files. The type of recovery depends on the nature and extent of the failure.
    • Complete Recovery: If backups and all necessary archived redo logs are available, a complete recovery can be performed. This involves restoring the affected components and applying all redo logs up to the point just before the failure.
    • Incomplete Recovery (Point-in-Time Recovery): If some archived logs are missing or if the goal is to recover the database to a specific point in time (like just before an erroneous transaction), incomplete recovery is performed. This involves restoring from backups and applying redo logs only up to a certain point, not the full extent available.

Each recovery type is guided by the database's operational state at the time of failure and the availability of backups and redo logs. The DBA must assess the situation accurately to choose the most appropriate recovery method. In all cases, the primary goal is to restore the database's integrity with minimal data loss and downtime, which requires a deep understanding of Oracle's recovery mechanisms and the specific environment's configuration.

Types of Backup and Recovery Options

There are two major categories of backup:
  1. Full backup: Includes backups of datafiles, datafile copies, tablespaces, control files (current or backup), or the entire database (including all datafiles and the current control file). Reads entire files and copies all blocks into the backup set, skipping only datafile blocks that have never been used (with the exception of control files and redo logs where no blocks are skipped).
  2. Incremental backup: Includes backups of datafiles, tablespaces, or the whole database. Reads entire files and backs up only those data blocks that have changed since a previous backup.
You can begin backups through the Recovery Manager or the Oracle Enterprise Manager interface to RMAN, which uses the database export facility, or you can initiate backups via standard operating system backup utilities. In general, RMAN supports most database backup features, including
  1. open or online backups,
  2. closed database backups,
  3. incremental backups at the Oracle block level,
  4. corrupt block detection,
  5. automatic backups,
  6. backup catalogs, and
  7. backups to sequential media.
RMAN added capabilities in Oracle9i for one-time backup configuration, recovery windows to determine and manage expiration dates of backups, and restartable backups and restores. Also added was support for testing of restores and recovery. Since Oracle Database 10g, RMAN can perform image copy backups of the database, tablespaces, or datafiles. RMAN can be used to apply incremental backups to datafile image backups. The speed of incremental backups is increased through a change-tracking feature by reading and backing up only changed blocks. The next lesson describes the complete recovery operation.