Backup Concepts   «Prev  Next»
Lesson 2Introduction to Backup and Recovery
ObjectiveUnderstand the basic principles of Oracle database backup, restoration, and recovery.

What Is Backup and Recovery?

A backup is a copy of data, which can include critical database components such as the control file and datafiles. Backups safeguard against unexpected data loss and application errors. If the original data is lost, you can use the backup to reconstruct it.

Backups are divided into:

  1. Physical backups
  2. Logical backups

Physical backups are copies of physical database files. In contrast, logical backups contain data extracted using the Oracle Export utility and stored in a binary file. Logical backups can supplement physical backups. Physical backups can be created using the Oracle Recovery Manager (RMAN) utility or operating system utilities.

To restore a physical backup is to reconstruct it and make it available to the Oracle database server. To recover a restored datafile is to update it using redo records, which are records of changes made to the database after the backup was taken. If you use Recovery Manager (RMAN), you can also recover restored datafiles using incremental backups, which contain only blocks that changed after the last backup.

Oracle performs crash recovery and instance recovery automatically after an instance failure. Instance recovery involves two operations:

  1. Rolling forward the backup to a more current time by applying online redo records.
  2. Rolling back all changes made in uncommitted transactions to their original state.

In contrast, media recovery requires manual intervention. Using SQL*Plus, you can issue the RECOVER or:

            
ALTER DATABASE RECOVER
            
        

statements to apply archived logs. If you use RMAN, you issue the recover command to apply archived redo logs or incremental backups to the datafiles.



Understanding Media Recovery

The following figure illustrates the basic principle of backing up, restoring, and performing media recovery on a database:

Basic principle of backing up

Oracle database media recovery process using archived redo logs. Below is a step-by-step breakdown with a focus on the archived redo logs:

Timeline and Events

  • The horizontal timeline represents System Change Numbers (SCNs), which Oracle uses to maintain transactional consistency.
  • Points marked at SCN 100, 200, 300, 400, 500.
  • A media failure occurs around SCN 500.

Database States

  1. Backup database: This is a backup copy of the database, taken around SCN 100.
  2. Restored database: The backup is restored to a new location or over the damaged database.
  3. Recovered database: After applying redo logs, the database is recovered up to the point before the media failure (e.g., SCN 500).

Archived Redo Logs – Core Role

  • The archived redo logs are shown as three stacked cylinders (tape/disc icons), representing a series of redo logs archived over time.
  • These logs capture all changes made to the database after the backup was taken.

Recovery Flow

  • Redo logs are applied in sequence to the restored database:
    • First log is used to bring the database from SCN 100 to 200.
    • Second log brings it from SCN 200 to 300.
    • Third log continues the recovery up to SCN 500.
  • The arrows show the redo changes being fed from archived redo logs into the restored database to reconstruct it.
  • Ultimately, this yields a recovered database that is consistent up to the point of media failure.

Figure 2-1: Basic principle of backing up, restoring, and performing media recovery on a database.


Summary: Archived Redo Logs’ Role

  • Allow point-in-time recovery.
  • Are critical for applying committed transactions after a backup.
  • Bridge the gap between backup SCN and failure SCN.
  • Enable full recovery of committed data without data loss, assuming all logs are intact.

SEMrush Software 2 SEMrush Banner 2