Both redo operations and undo operations are provided for returning a database that is corrupted to a correct state. When corruption of the database is detected, an automatic selection is made of one or more operations from the redo operations and undo operations for returning the database that is corrupted to a correct state. The selected one or more redo and undo operations are then performed on the database, thereby returning the database that is corrupted to a correct state.