What is the Difference Between Undo and Redo in Oracle

The main difference between undo and redo in Oracle is that undo helps in rollback and maintaining read consistency while redo helps in rolling forward database changes.

Oracle RDBMS is a proprietary multi-model database management system that belongs to Oracle Corporation. Overall, undo and redo are records available in Oracle RDBMS. Undo is a record of a transaction before it is committed. On the other hand, redo is an entry in redo log files that holds a group of change vectors.

Key Areas Covered

1. What is Undo in Oracle
     -Definition, Functionality
2. What is Redo in Oracle
     -Definition, Functionality
3. Difference Between Undo and Redo in Oracle
     -Comparison of key differences

Key Terms

Oracle, RDBMS, Redo, Undo

Difference Between Undo and Redo in Oracle - Comparison Summary

What is Undo in Oracle

Oracle database creates and manages information that is used to roll back. Here, this information refers to the records on transactions before they are committed. These records are also called undo.

Undo tablespace is a specific tablespace that only stores undo information. Therefore, it is not possible to create any tables/indexes etc. to undo tablespaces. Each database contains zero or more undo tablespaces. In Oracle, there is an automatic undo management mode. Every Oracle instance is assigned with a single undo tablespace. These undo tablespaces manage to undo data using undo segments.

Difference Between Undo and Redo in Oracle

Generally, undo records support multiple tasks. These help to roll back transactions and to recover the database. It is also possible to analyze data of an earlier point in time by using the Oracle Flashback query. Furthermore, there is a possibility of recovering from logical corruptions using Oracle flashback features.

When issuing a ROLLBACK statement, undo records help to undo changes made to the database by the uncommitted transaction. At the time of recovering the database, the undo records allows undoing any uncommitted changes applied to form the redo log to the datafiles. Furthermore, undo records provide read consistency.

What is Redo in Oracle

Oracle provides redo logs. These logs contain files with a history of all changes made to the database. Each redo log file has a set of redo records or redo entries. A redo record stores a set of change vectors which denotes a change made to a single block in the database. These files protect the database from system failures due to disk failures etc. Furthermore, it is important to multiplex the redo log files to avoid information loss during a disk failure.

Difference Between Undo and Redo in Oracle

Definition

Undo is a record of a transaction before it is committed in Oracle RDBMS. In contrast, an entry in redo log files that holds a group of change vectors in Oracle RDBMS.

Stored in

Moreover, undo segments store undo records while redo log files save redo records.

Usage

We use Undo for rollback and read consistency and redo for rolling forward database changes.

Protection

Furthermore, undo protects against inconsistent reads in multiuser systems whole redo protect against data loss.

Conclusion

Oracle RDBMS is a product of Oracle Cooperation. Many organizations use it to store their business transactions. In brief, undo and redo are available in Oracle databases. The main difference between undo and redo in Oracle is that undo helps in rollback and to maintain read consistency while redo helps in rolling forward database changes.

References:

1.“Database Administrator’s Guide.” Moved, 13 Mar. 2008, Available here.
2.“Redo Log.” Wikipedia, Wikimedia Foundation, 13 Aug. 2017, Available here.
3.“Oracle Database.” Wikipedia, Wikimedia Foundation, 25 July 2019, Available here.

Image Courtesy:

1.” Oracle Logo” By Oracle –  (Public Domain) via Commons Wikimedia

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply