Oracle Instance Recovery

Instance recovery is the process of applying records in the online redo log to data files to reconstruct changes made after the most recent checkpoint. Instance recovery occurs automatically when an administrator attempts to open a database that was previously shut down inconsistently.
Purpose of Instance Recovery

Instance recovery ensures that the database is in a consistent state after an instance failure. The files of a database can be left in an inconsistent state because of how Oracle Database manages database changes.

A redo thread is a record of all of the changes generated by an instance. A single-instance database has one thread of redo, whereas an Oracle RAC database has multiple redo threads, one for each database instance.

When a transaction is committed, log writer (LGWR) writes both the remaining redo entries in memory and the transaction SCN to the online redo log. However, the database writer (DBW) process writes modified data blocks to the data files whenever it is most efficient. For this reason, uncommitted changes may temporarily exist in the data files while committed changes do not yet exist in the data files.

f an instance of an open database fails, either because of a SHUTDOWN ABORT statement or abnormal termination, then the following situations can result:

Data blocks committed by a transaction are not written to the data files and appear only in the online redo log. These changes must be reapplied to the database.
The data files contains changes that had not been committed when the instance failed. These changes must be rolled back to ensure transactional consistency.

Instance failure can be the result of software failure, hardware failure, or the use of emergency shutdown commands.

Option 1 is correct. Instance failure can be the result of hardware failure – for example, a disk may be corrupted due to a power outage.
Option 2 is incorrect. Listener failure is a type of network failure and can occur even if the instance is still running.
Option 3 is correct. Instance failure can be the result of software failure – for example, the failure of background processes.
Option 4 is correct. Instance failure can be the result of the issuing of emergency shutdown commands such as SHUTDOWN ABORT and STARTUP FORC

Instance recovery occurs in two steps:

Cache recovery: Changes being made to a database are recorded in the database buffer cache. These changes are also recorded in online redolog files simultaneously. When there are enough data in the database buffer cache, they are written to data files. If an Oracle instance fails before the data in
the database buffer cache are written to data files, Oracle uses the data recorded in the online redo log files to recover the lost data when the associated database is re-started. This process is called cache recovery

Transaction recovery: When a transaction modifies data in a database, the before image of the modified data is stored in an undosegment. The data stored in the undo segment is used to restore the original values in case a transaction is rolled back. At the time of an instance failure, the database may have uncommitted transactions. It is possible that changes made by these uncommitted transactions have gotten saved in data files. To maintain read consistency, Oracle rolls back all uncommitted transactions when the associated database is re-started. Oracle uses the undo data stored in undo
segments to accomplish this. This process is called transaction recovery.