Key Structural Components for Data Recovery

It is important to understand Oracle database structural components that are essential for data recovery.

  1. System Global Area (SGA): The SGA is a shared memory structure that contains data and control information for a given database instance. The SGA contains separate buffer areas, such as the redo log buffer.
  2. Redo Logs: In an Oracle Database, redo logs are the crucial structure for data recovery in case of a failure. A redo log consists of a minimum of two or more preallocated files that maintain logs of database transactions, as they occur, after a backup. Each redo log file is filled with redo records. Redo log entries are generated in the redo log buffer of the SGA. The log writer process (LGWR) is an Oracle background process that is responsible for writing the redo log buffer into redo log files. The database requires that each redo log contains a minimum of two redo log files to guarantee that one is always available for writing while the other is being archived (if the Oracle Database is running in the ARCHIVELOG mode). The LGWR process writes to redo log files in a circular fashion. When the current redo log file is full, LGWR begins writing to the next available redo log file.
  3. Archived Redo Logs: When you cannot afford to lose data, Oracle recommends that you run your Oracle Database instance in the ARCHIVELOG mode. The ARCHIVELOG mode enables the archiving of filled redo logs. When a database is mounted, run the ALTER DATABASE ARCHIVELOG statement to enable the archiving of filled redo log files. You can choose to archive redo logs to more than one chosen destination. For example, you can archive filled redo logs to a local disk, an Oracle Automatic Storage Management (Oracle ASM) disk group, and the fast recovery area (FRA). Define the LOG_ARCHIVE_DEST_n initialization parameter to specify more than one destination to archive the filled redo logs. The database starts multiple archive processes, as needed, to ensure that the archiving of filled redo logs does not fall behind. A copy of each filled redo log file is written to each destination. In the event of a database failure, you can first restore a full database backup and then use the archived redo log files to recover a database to a recent committed transaction that occurred before a specified point in time.

Backup Concepts

Here are some key terms and concepts that concern the backup and recovery scenario for your Oracle Databases.

RMAN Backup Strategy to Recovery a Database After a Failure

You use Recovery Manager (RMAN), an Oracle Database client, to perform backup and recovery operations for your Oracle Databases.

4. Weekly Full, Daily Incremental and Hourly Archived Redo Log Backups: In this strategy, an incremental L0 backup is taken once a week. The subsequent incremental L1 backups can be taken on a daily or an hourly basis. Incremental L1 backups require lesser storage space and have shorter backup windows.

Consider an Oracle Database that is backed up (L0) weekly on Sundays at 11:00 PM. The daily incremental L1 backups are taken at noon everyday starting from Monday to Saturday. Monday's incremental L1 backup will contain all the changes that occurred in the database since Sunday's incremental L0 backup. However, Tuesday's incremental L1 backup will contain only the changed data since Monday's incremental L1 backup. This daily incremental L1 backup trend continues until the next weekly incremental L0 backup is taken. In addition, an hourly archived redo log backup is taken to ensure that the archived redo log files are backed up.

If a database failure occurs, you use RMAN to restore the database using the most recent incremental L0 backup, and recover the database by applying the incremental L1 backups and the most recent archived redo log backup. When RMAN is connected to a target database, run the RESTORE command to restore the data files from a backup. Run the RECOVER command to automatically restore and apply both incremental backups and archived redo logs.

Consider that a disk failure occurs at 3 PM, on Friday. You begin by restoring the L0 backup taken on Sunday, next apply the incremental L1 backups sequentially in the order of Monday through Friday, and finally apply the archive redo logs from the most recent archive redo log backup (taken at 2:45 PM on Friday, minutes before the crash). This ensures that you can recover the database with a recovery point objective that guarantees that you can recover all the committed transactions with minimal data loss and shorter recovery time.

Note: While recovering a database from failure, RMAN always chooses incremental backups over archived redo logs because applying changes at a block level is faster than applying redo logs.

5. In the absence of incremental L1 backups, restoring a database requires a very long recovery time because after you restore the full backup you must sequentially apply a long-chain of redo logs to recover the database to a specified point in time.