In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to achieve transaction operation isolation mode in SQL Server. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
1. Dirty data reads and writes, which occurs when one transaction reads and writes data that is modified by another transaction and is not committed. If another thing never commits its modified data, the first transaction will always get an invalid value, that is, dirty data.
two。 Cannot be read or written repeatedly, which occurs when one transaction is trying to read the same data repeatedly, while another transaction modifies the data before the first transaction repeats it. This causes the first transaction to get two different values when reading the same data, making the original data read non-repeatable.
3. Image read and write, which occurs when one transaction makes multiple data queries in a table, while another transaction inserts or deletes data rows that meet the query criteria. This causes the previous transaction to gain or lose an "image" value.
Each isolation mode of SQL Server attempts to solve some of the above problems, enabling database administrators to maintain a balance between transaction operation isolation and business requirements. Here are five isolation modes for SQL Server:
1. Read-write commit isolation mode, which is the default isolation mode for SQL Server, and the database does not allow transaction operations to read and write data written by uncommitted transaction operations. This mode prevents dirty data from reading and writing, but does not prevent image reading and writing or non-repeatable reading and writing.
two。 Read-write uncommitted isolation mode, which is basically not isolated between transaction operations. Any transaction can read and write data written by another uncommitted transaction. In this mode, transaction operations are prone to dirty data reading and writing, image reading and writing, and non-repeatable reading and writing.
3. The repeatable read-write isolation mode, which goes further than the read-write commit isolation mode, prevents a transaction from modifying data that is being read and written by another transaction until the read-write operation is completed. This isolation mode prevents dirty data from reading and writing and non-repeatable reading and writing.
4. Serialized isolation mode, which uses scope locks to prevent one transaction from inserting or deleting rows of data while another transaction reads the data. Serial isolation mode can prevent the occurrence of the above three situations.
5. Snapshot isolation mode, which can also prevent the occurrence of three situations, but in different ways. It provides each transaction with a "snapshot" of its query data, and the transaction can query the snapshot without having to return to the source data table, thus preventing dirty data reading.
If you want to change the isolation mode used by SQL Server, simply enter the following command:
The copy code is as follows: SET TRANSACTION ISOLATION LEVEL
The following keywords can be used instead:
READ COMMITTED
READ UNCOMMITTED
REPEATABLE READ
SERIALIZABLE
SNAPSHOT
The above is how to achieve transaction operation isolation mode in SQL Server shared by Xiaobian. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.