Brief Introduction to the functions of transactions and locks in Oracle databases

Source: Internet
Author: User

Transactions and locks have the following features:

A transaction is a unit of work, either completely or completely.
Transactions ensure operation consistency and recoverability
Each Transact-SQL statement can be a transaction.
The actual transaction is a user-defined transaction, which includes a series of operations or statements.
In a multi-server environment, user-defined distributed transactions are used to ensure operation consistency.
Lock is a means to ensure Concurrency Control
Resources that can be locked include rows, pages, clusters, tables, and databases.
The lock types mainly include shared locks and exclusive locks.
Special types of locks include intent locks, modification locks, and mode locks.
The shared lock allows other transactions to continue to use the locked resources.
The exclusive lock allows only one transaction to access data.
The system can handle deadlocks.
You can customize the features of the lock based on the actual situation.
Transactions

Transaction Definition

A transaction refers to the work of a unit, which is either done in full or not done in all. As a logical unit, it must have four attributes: automation, consistency, independence, and persistence. Automatic means that a transaction must be an automatic unit operation, either to modify all data or to modify all data. Consistency means that all data must be consistent when the transaction is completed. In relational databases, all rules must be applied to transaction modifications to maintain the integrity of all data. All internal data structures, such as links between tree indexes and data, must be confirmed after the transaction ends. Independence means that the modification of a parallel transaction must be independent from the modification of other parallel transactions. The data seen by a transaction is either the status before the transaction is modified by another transaction, or the data that has been modified by the second transaction, but the data being modified cannot be seen by this transaction. This feature is also known as seriality. Durability means that after a transaction is completed, its impact is permanently generated in the system, that is, the repair is rewritten to the database.

The transaction mechanism ensures that the modification of a group of data is either completely executed or not executed. SQL Server uses transactions to ensure data consistency and recoverability when the system fails. A transaction is a recoverable Unit. It is composed of one or more statements, which can affect one or more rows of data in a table. After the transaction is opened, it is committed after the transaction is successfully completed, or when the transaction fails to be fully canceled or rolled back.

Transactions and locks
When a transaction is executed, Oracle will be shackled by the affected table to prevent other users from modifying the table structure. This is very useful for our users.
Several operations of common transactions
1. Set savepoint.
2. Cancel partial transaction rollback to
3. Cancel all transaction rollback

Rollback transaction: rollback
Commit transaction: commit

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.