Đang chuẩn bị liên kết để tải về tài liệu:
Hướng dẫn học Microsoft SQL Server 2008 part 142

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Quản lý tài nguyên tranh là về cách viết code sử dụng như là nguồn tài nguyên ít nhất có thể để cho phép nhiều người sử dụng có thể thực thi mã tại cùng một thời điểm. | Part IX Performance Tuning and Optimization Result Spid Object Type Mode Status 54 HumanResources.Department PAGE IX GRANT 54 HumanResources.Department KEY X GRANT Transaction 2 ensures that the transaction isolation level is set to the default and then attempts to read the same row transaction 1 is updating -- Transaction 2 USE AdventureWorks2008 SET TRANSACTION ISOLATION LEVEL READ COMMITTED SELECT Name FROM HumanResources.Department WHERE DepartmentID 1 There is no result yet for transaction 2. It s waiting for transaction 1 to complete blocked by transaction 1 s exclusive lock. Requerying sys.dm_tran_locks reveals that the second transaction SPID 51 has an intent to share IS read lock and is waiting for a share S read lock. Result Spid Object Type Mode Status 51 HumanResources.Department PAGE IS GRANT 51 HumanResources.Department PAGE S WAIT 54 HumanResources.Department KEY X GRANT 54 HumanResources.Department PAGE IX GRANT 54 HumanResources.Department PAGE IX GRANT 54 HumanResources.Department KEY X GRANT 54 HumanResources.Department KEY X GRANT While transaction 1 is holding its exclusive lock transaction 2 has to wait. In other words transaction 1 is blocking transaction 2. Now transaction 1 commits the transaction and releases the exclusive lock -- Transaction 1 COMMIT TRANSACTION Immediately transaction 1 completes and releases its locks. Transaction 2 springs to life and performs the select reading the committed change. 1372 www.getcoolebook.com Managing Transactions Locking and Blocking 66 Result Name New Name The point of transaction isolation level read committed is to avoid reading uncommitted data. What if the update doesn t change the data If transaction 1 updates the data from John to John what s the harm of reading John SQL Server handles this situation by not respecting an exclusive lock if the page hasn t been changed i.e. if the page isn t flagged as dirty. This means that sometimes because there s probably more data on the page than just the .