DBMS provide safety features that prevent the loss of data due to hardware failure. The basic mechanism is that of transactions. A transaction is a sequence of data definition or manipulation commands that is considered as atomic by the DBMS; a transaction either succeeds completely, or fails and undoes all data changes (rollback).
During a transaction, the DBMS works on a copy of the data; if the transaction succeeds, the copy is written to permanent storage, otherwise it is simply discarded.
Transactions may be visible to the user. Other mechanisms to preserve the physical integrity of data are invisible: