Database--Database recovery technology

Source: Internet
Author: User

1. Transaction: A user-defined sequence of database operations, which are either wholly or completely not, is an inseparable unit of work
2. Characteristics of the transaction: atomicity (atomicity), consistency (consistency), isolation (isolation), persistence (durability)
Atomicity: Either to do it all or not to do it all
Consistency: The result of a transaction must be to change the database from one consistent state to another
Isolation: The execution of one transaction cannot be disturbed by other transactions, that is, the operations within one transaction and the data used are isolated from other concurrent transactions, and the transactions performed concurrently cannot interfere with each other.
Persistence: Once a transaction is committed, its changes to the data in the database should be permanent
3. Type of failure: Transaction internal failure, system failure, media failure, computer virus
4. Recovery technology
(1) Data dump: The DBA periodically copies the entire database to another disk
Static dump: A dump operation that occurs when the system does not have a transaction run, does not allow any access to the database during the dump, modifies the activity
Dynamic dump: Allows access or modification of the database during a dump, that is, dumps and user transactions can be executed concurrently.
Mass dump: Dumps all databases at a time
Incremental dumps: Only the data that was updated after the last dump is dumped each time
5. Rules for registering log files
(1) The Order of registration is strictly in accordance with the time sequence of concurrent transaction execution
(2) The log file must be written before the database is written
6. Transaction failure recovery, the transaction runs to the normal end of the termination before the recovery subsystem should use the log file to revoke the transaction has been modified to the database, the recovery of the transaction failure is automatically completed by the system
(1) Reverse scan log file (from the last forward scan of the log file) to find an update operation for the transaction
(2) Reverse operation of update operation for the transaction
(3) Continue to reverse scan the log file to find other update operations
(4) This process continues until the beginning of this transaction is marked
7. System failure Recovery: An update to the database that has not completed the transaction may have been written to the database, and the update of the committed transaction to the database may still remain in the buffer before it can be written to the database. System failure recovery is done automatically when the system restarts.
(1) Scan the log file (scan the log file from scratch), identify the transaction that was committed before the failure occurred, and mark the transaction into the redo queue. Also identify that the failure occurred is a transaction that has not been completed, and mark its token in the undo queue
(2) Undo each transaction in the undo queue
The undo process is to reverse-scan the log file, perform an inverse operation on each undo transaction, and write the value before the update to the database
(3) Perform redo processing for each transaction in the redo queue
Forward scan log files, redo log file enlistment for each redo transaction, write the updated value in the log record to the database
8. Media failure Recovery Reload database, Redo completed transaction

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.