Advertisement
Guest User

Untitled

a guest
May 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.97 KB | None | 0 0
  1. -- Найти allocation page contention in tempDB. Можно сказать если тут нет проблем, значит нет смысла менять количество файлов данных базы tempdb
  2.     Select session_id,
  3.     wait_type,
  4.     wait_duration_ms,
  5.     blocking_session_id,
  6.     resource_description,
  7.           ResourceType = Case
  8.     When Cast(Right(resource_description, Len(resource_description) - Charindex(':', resource_description, 3)) As Int) - 1 % 8088 = 0 Then 'Is PFS Page'
  9.                 When Cast(Right(resource_description, Len(resource_description) - Charindex(':', resource_description, 3)) As Int) - 2 % 511232 = 0 Then 'Is GAM Page'
  10.                 When Cast(Right(resource_description, Len(resource_description) - Charindex(':', resource_description, 3)) As Int) - 3 % 511232 = 0 Then 'Is SGAM Page'
  11.                 Else 'Is Not PFS, GAM, or SGAM page'
  12.                 End
  13.     From sys.dm_os_waiting_tasks
  14.     Where wait_type Like 'PAGE%LATCH_%'
  15.     And resource_description Like '2:%' -- 2 это id БД
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement