SQL 인스턴스의 차단 세션을 모니터링합니다.
차단 세션 모니터는 차단 상황이 존재하는지 검색합니다.
한 세션에서는 특정 리소스를 잠그고 다른 세션에서는 동일한 리소스에 대해 충돌하는 잠금 유형을 얻으려는 경우 차단이 발생합니다. 차단은 잠금 기반 동시성을 가진 모든 RDBMS(관계형 데이터베이스 관리 시스템)의 불가피한 특성이지만 너무 많은 차단으로 인해 성능 문제가 발생할 수 있습니다.
시스템 성능에 상당한 영향을 줄 정도로 잠금 및 차단이 많아지는 이유는 일반적으로 다음 중 하나입니다.
세션이 리소스 집합을 잠근 후 해제하지 않습니다. 해제하지 않습니다.
롤백되지 않은 취소된 쿼리
분리된 트랜잭션
session_id 또는 “SPID”로 식별되는 세션이 리소스 집합을 오랫동안 잠근 후 해제합니다. 해제하지 않습니다.
장기 실행 트랜잭션
적합한 인덱스 부족
부적합한 잠금 힌트 사용
잘못된 응용 프로그램 디자인과 관련된 다른 문제
차단 체인의 헤드에 있는 세션을 중지합니다.
트랜잭션 시간을 줄입니다.
적합한 인덱스를 만듭니다.
잠금 힌트를 사용합니다. SQL Server 온라인 설명서를 참조하십시오.
행 버전 관리 기반의 격리 수준을 사용합니다.
SQL Server 설정(메모리 설정, 잠금 제한 시간 등)을 구성합니다.
이 특정 데이터베이스 또는 모든 데이터베이스에 대해 모니터의 임계값 변경
또는 데이터베이스에서 차단 세션이 별로 중요하지 않을 경우 다음을 수행합니다.
이 특정 데이터베이스 또는 모든 데이터베이스에 대해 모니터 비활성화
참고 항목: “ INF: SQL Server 차단 문제 이해 및 해결”
Target | Microsoft.SQLServer.2008.DBEngine | ||
Parent Monitor | System.Health.PerformanceState | ||
Category | PerformanceHealth | ||
Enabled | False | ||
Alert Generate | True | ||
Alert Severity | Error | ||
Alert Priority | High | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.SQLServer.2008.DBEngine.BlockedSPIDs | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Default |
<UnitMonitor ID="Microsoft.SQLServer.2008.DBEngine.BlockedSPIDsMonitor" Accessibility="Public" Enabled="false" Target="SQL2008Core!Microsoft.SQLServer.2008.DBEngine" ParentMonitorID="SystemHealth!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2008.DBEngine.BlockedSPIDs" ConfirmDelivery="false">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2008.DBEngine.BlockedSPIDsMonitor.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>High</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='BlockedSPIDList']$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter3>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Blocked" MonitorTypeStateID="Blocked" HealthState="Error"/>
<OperationalState ID="NotBlocked" MonitorTypeStateID="NotBlocked" HealthState="Success"/>
</OperationalStates>
<Configuration>
<ConnectionString>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ConnectionString$</ConnectionString>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<WaitMinutes>1</WaitMinutes>
<NumberBlockedSPIDs>1</NumberBlockedSPIDs>
<TimeoutSeconds>300</TimeoutSeconds>
<InstanceName>$Target/Property[Type="SQL!Microsoft.SQLServer.ServerRole"]/InstanceName$</InstanceName>
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
</Configuration>
</UnitMonitor>