블로그 이미지
bedbmsguru

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
  • total
  • today
  • yesterday
2016. 4. 26. 16:05 SQL SERVER

SELECT
    s.NAME AS SchemaName, 
    t.NAME AS TableName,
    p.rows AS RowCounts,
    SUM(a .total_pages) * 8 /1024 AS TotalSpaceMB,  
    SUM(a .used_pages) * 8 /1024 AS UsedSpaceMB,  
    (SUM( a.total_pages ) - SUM( a.used_pages )) * 8 /1024 AS UnusedSpaceMB
FROM  sys .tables t
INNER JOIN sys. Schemas s ON t.schema_id = s.schema_id
INNER JOIN sys. indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN sys. partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN sys. allocation_units a ON p.partition_id = a.container_id
WHERE 
    t.NAME NOT LIKE 'dt%'  
    AND t .is_ms_shipped = 0
    AND i .OBJECT_ID > 255 
GROUP BY
 s. Name, 
    t.Name ,
    p.[Rows]
ORDER BY  
 TotalSpaceMB desc

posted by bedbmsguru
2016. 4. 26. 11:18 SQL SERVER


Index Rebuild 시 아래의 에러가 발생할 경우


메시지 1943 수준 16, 상태 1, 줄 1

페이지 수준 잠금이 비활성화되어 있으므로 테이블 "테이블명" 의 인덱스 "인덱스명"을(를) 다시 구성할 수 없습니다.



개발자가 SSMS에서 인덱스를 생성하여 page_locked 옵션 체크가 해제된 상태에서 인덱스를 생성하였음



수정쿼리

ALTER INDEX [인덱스명] ON [테이블명] SET ( ALLOW_PAGE_LOCKS  = ON )




posted by bedbmsguru