Shadow Database in DBMS

Atomicity and Durability of transaction can also be achieved by shadow database. In this method, all the changes of transactions are updated in the shadow copy (duplicate copy) of the database. Once all the transaction is complete, the DB pointer is made to point to this shadow database, making this as the new copy of the DB. The old copy of DB is then deleted.

If there is any failure during the transaction, the pointer will be still pointing to old copy of database, and shadow database will be deleted. If the transactions are complete then the pointer is changed to point to shadow DB, and old DB is deleted.

As we can see in above diagram, the DB pointer is always pointing to consistent and stable database. This mechanism assumes that there will not be any disk failure and only one transaction executing at a time so that the shadow DB can hold the data for that transaction. It is useful if the DB is comparatively small because shadow DB consumes same memory space as the actual DB. Hence it is not efficient for huge DBs. In addition, it cannot handle concurrent execution of transactions. It is suitable for one transaction at a time.

Next > < Prev
Scroll to Top