2

직렬화 가능 트랜잭션을 만드는 다음 코드가 있습니다. 응용 프로그램이 예상대로 작동합니다.SQL 프로파일 러가 모든 ADO.NET 작업을 표시하지 않습니다.

using (var tx = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable, Timeout = new TimeSpan(0, 2, 0) })) 
{ 
    // Modify database using EF. 
    tx.Complete(); 
} 

그러나 데이터베이스를 프로파일 링하면 다소 혼동을 느끼게됩니다. I는 제 질의 실제로 직렬화 하에서 실행된다 볼 수 있으므로

// Start of transaction (and the first query). Login has invalid ISO LEV. 
Audit Login  ... set transaction isolation level read committed ... 
SQLTransaction 0 - Begin 
RPC:Completed  exec sp_executesql N'SELECT TOP (1)... 

// Second query in transaction. Login now has valid ISO LEV. 
Audit Logout 
RPC:Completed  exec sp_reset_connection 
Audit Login  ... set transaction isolation level read serializable ... 
RPC:Completed  exec sp_executesql N'SELECT TOP (1)... 

은 (I는 습득 잠금에서이 추론 할 수 있음)를 그릴 수있는 유일한 근거는 로그인 감사 단순히 SPID의 ISO 수준을 상태 인 로그온의 요점은 이 아니라으로 바뀌 었습니다.

그렇다면 ISO 변경을 유발하는 이벤트는 어디에 있습니까? 모든 이벤트가 켜져있어 아무 것도 볼 수 없습니다 ...

답변

1

트랜잭션 격리 수준을 변경하면 RPC:Completed 이벤트가 아닙니다.

SQL:BatchStartingSQL:BatchCompleted 이벤트를 모니터링하고 있는지 확인하십시오.

+1

내 흔적에 이미 있습니다. TransactionScopes에 대한 격리 수준은 표시하지 않습니다. –