"Computer Management--the principle of database System"--database management

Source: Internet
Author: User

Defined:

DBMS monitoring of the DB, known as database management, or database protection.


******************************************

The minimum logical working unit for DBS runs is: transactions.

Transaction definition:

is the set of operations that make up a single logical unit of work, either fully executed or not executed at all.

For example:

Bank Deposit and withdrawal: either the correct access, or completely do not execute, can not appear: the money put in, but the account did not add money to the situation.

That is, only a set of steps are completed before the transaction can be declared to execute successfully, and if there is an error, the database must be restored to the most initial state of the transaction.

Therefore, the transaction has the following properties:

atomicity: All of the operations as a whole, either wholly or completely.

Consistency: Transaction execution results are consistent with the database and must not cause database data to be garbled due to transaction execution.

Isolation: Multiple transactions are executed concurrently and should remain consistent with individual execution results

Persistence: After a transaction completes, updates to the database should be permanently reflected in the database. Even if a system failure occurs.


**************************************

Recovery of the database:

The system can restore the database from a corrupted, incorrect state to a recent correct state, which is known as the recoverability of the database.

Strategy:

Two things to do: dump, build logs.

Two processing: If the hardware is damaged, you need to back up the most recent copy of the database to a new disk and use the log library to perform a redo. If there is no physical damage, no copying, as long as the log "undo" all the unreliable modifications, and then "Redo" has been committed, but the update may also remain in the memory buffer of the transaction.

*************************************

Concurrency control:

Problem: Missing update, read dirty data, non-repeatable read.

Blocking: The role of a lock is to enable concurrent transactions to synchronize access to data items in the database.

< Span style= "font-family:kaiti_gb2312; font-size:24px ">    shared lock (S-Lock): if transaction T adds a shared lock to data A, Other transactions can only have a plus shared lock, and cannot add an exclusive lock. The transaction function that is allowed to share the lock reads data and cannot modify the data. (for example: Word document, first Open is readable and editable, but when it is opened and opened again, is read-only, I think this should be the meaning of S-lock)

Exclusive Lock (x Lock): If transaction T adds an exclusive lock to data A, other transactions cannot be blocked on a plus any type.
transactions that have been granted an exclusive lock can read data and modify it.
reason for database deadlock: Several transactions wait for each other to release the blockade, then fall into an indefinite wait state and the system goes into deadlock.
methods to prevent database deadlock: 1, requires that a transaction must be blocked all the data required (either full success or all success) 2, the order of blocking data, all transactions must be in this order to implement the blockade
How to unlock a database: Allow a deadlock to occur, then release it, and if a deadlock is found, undo one of the less expensive transactions, roll back the transaction, and release the lock held by this transaction, so that other transactions continue.



Summary: Database management, mainly for the security of the database. Database recovery, concurrency control, and integrity control are all designed to protect the database from unauthorized use and to prevent the disclosure, alteration, or destruction of data.


"Computer Management--the principle of database System"--database management

Related Article

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.