Computer Management-database system principles-database management and database system principles

Source: Internet
Author: User

Computer Management-database system principles-database management and database system principles

Definition:

DBMS monitoring of databases is called database management or database protection.


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

The smallest logical unit of work that DBS run is transaction.

Transaction definition:

Is a set of operations that constitute a single logical unit of work, either complete or not executed.

For example:

Bank deposit and withdrawal: either the deposit and withdrawal are correct, or they are not executed at all. The deposit is not allowed.

That is, the transaction can be successfully executed only after a set of steps are completed. If an error occurs, the database must be restored to the initial state of the transaction.

Therefore, transactions have the following properties:

Atomicity: all operations are either full or not.

Consistency: the transaction execution result must be consistent with the database. Database Data disorder cannot be caused by transaction execution.

Isolation: Concurrent execution of multiple transactions should be consistent with the results of separate execution.

Persistence: after the transaction is completed, database updates should be permanently reflected in the database. Even if the system fails.


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

Database Restoration:

The system can restore the database from the damaged or incorrect state to the most recent correct state. This ability of DBMS is called the recoverability of the database.

Policy:

Two things: dump and log creation.

Two types of processing: If the hardware is damaged, you need to back up the last copied database to a new disk and use the logstore for "redo ". If it is not physically damaged and does not need to be copied, you only need to use the log to "undo" all unreliable modifications and then "redo" The committed transactions, but the updates may remain in the memory buffer.

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

Concurrency Control:

Problems: loss of updates, read of dirty data, and non-repeated reads.

Lock: the lock is used to synchronize the access of concurrent transactions to data items in the database.

Share lock (S lock): If transaction T adds A share lock to Data A, other transactions can only add A share lock to A, but cannot apply exclusive locks. The transaction function authorized to share the lock reads data and cannot modify the data. (For example, when a Word file is opened for the first time, it can be readable and editable. However, when one word file is opened and opened again, it is read-only. I think this should be the meaning of the S lock)

Exclusive lock (X lock): If transaction T adds an exclusive lock to data a, other transactions cannot block AAS any type.
Transactions authorized for exclusive locks can read and modify data.
Cause of database deadlock: some transactions wait for the other party to release and block each other, and the system enters the Deadlock State for an indefinite period of time.
Methods To prevent database deadlocks: 1. require a transaction to block all required data (either completely successful or all successful) at one time. 2. Define the sequence of blocked data, all transactions must be blocked in this Order
How to remove a database deadlock: allow the deadlock to occur, and then cancel it. If a deadlock is found, cancel one of the transactions with a low cost and roll back the transaction, and release the blockout held by this transaction so that other transactions can continue.



Summary: database management is mainly used for database security. Database recovery, concurrency control, and integrity control are designed to protect the database and prevent unauthorized use, so as to avoid data leaks, changes, or damages.


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.