Rolling back rollback

Source: Internet
Author: User

  

To ensure that the database can be restored to ensure database integrity after an application, database, or system error occurs, a rollback is required.

rolling back (rollback) is to restore the database data to the state of the database data before the transaction is committed.

  Rollback performs the opposite operation, which can undo the wrong operation, thus guaranteeing the integrity of the data.

For example, a userAto the userBtransfer, in the database you need toAwith theBaccount information to be modified.(update)operation, and these two stripsSQLstatement must either be executed or not executed. For example, first execute userBthe modification(update)statement that enables the userBThe account amount is increased. +, and then execute the userAof theUpdatestatement that enables the userAreduced the amount of the account +. If the userAaccount amount is greater than +, the transaction goes smoothly and there is no problem, but when the userAThe account amount is less than +, because the transfer amount is not allowed to be greater than the account amount, the secondSQLstatement is not executed correctly, the state of the database must return to theBof theUpdatestatement, a rollback is required to perform the reverse operation, and then theBof theUpdateamount minus +.

Note the rollback with Revoke the difference.   rollback refers to restoring the state of the database to the state before the transaction was performed, which may be rolled back using the UNDO log.  Revocation is a way of logging, not primarily for transactional rollback, but primarily for system recovery from failure. For example, the system suddenly loses power, and the system will process the unfinished transaction according to the UNDO Log, ensuring that the state of the database is the state before the transaction was executed.

Rolling back rollback

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.