Transaction failure, media failure, system failure recovery methods and their differences

1.     
What does a database transaction failure mean? After a transaction failure occurs, how does the DBMS recover the database?

Transaction failure means that a transaction aborts before it reaches the normal termination point due to various reasons during operation.

Recovery method: Undo the transaction. That is, all modifications made to the database by the transaction are cleared, making it appear as if the transaction has never been started at all. (Undo needs to be done from back to front, with the update impact of the latest completed operation disappearing first. Therefore, the log file needs to be scanned from back to front.)

2.     
What does a database system failure mean? After a system failure occurs, how does the DBMS restore the database?

A system failure is any event that causes the system to stop functioning, requiring it to be restarted.

Recovery method: ① Clear all modifications to the database by unfinished transactions, UNDM (undo) all unfinished transactions (from back to front).

② Write the results of completed transaction submissions in the buffer to the database, and REDO (redo) all submitted transactions (from front to back).

3.     
What does a database media failure mean? How does the DBMS recover the database after a media failure occurs?

Media failure refers to a hardware failure that causes the loss of data stored on the hard drive. (More destructive than the first two failures)

Recovery method: ① On the new disk, import the latest database backup file.

② Based on the log file, find out which transactions have been completed from the latest backup to the time of the failure.

REDO (redo) all committed transactions. (from front to back).

4.     
What are the similarities and differences between recovery techniques for database transaction failures and system failures?

The same thing: they all need to UNDO (undo) all unfinished transactions (from front to back).

Difference: System failure requires REDO (redo) of completed transactions that have not yet been written to disk.

5.     
What are the similarities and differences between recovery technologies for database media failures and system failures?

① Media failure requires database backup and import the backup file to new media.

② Both faults require redoing, but the scope of redoing is different.

③ System failure requires REDO (redo) of completed transactions that have not yet been written to the disk.

③Media failure requires REDO (redo) of all completed things from the last latest backup to the failure.

Guess you like

Origin blog.csdn.net/qq_45972928/article/details/104713087