diff --git a/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2012 and newer).rdl b/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2012 and newer).rdl index f0f9360..70455f5 100644 --- a/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2012 and newer).rdl +++ b/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2012 and newer).rdl @@ -1,6 +1,7 @@ Segoe UI + Eitan Blumin 0 diff --git a/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2019 and newer).rdl b/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2019 and newer).rdl index 2e82ab7..0084911 100644 --- a/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2019 and newer).rdl +++ b/ssrs-custom-reports/Data File Allocation Map - Detailed (SQL2019 and newer).rdl @@ -1,6 +1,7 @@ Segoe UI + Eitan Blumin 0 diff --git a/ssrs-custom-reports/Data File Allocation Map - Overview (SQL2012 and newer).rdl b/ssrs-custom-reports/Data File Allocation Map - Overview (SQL2012 and newer).rdl index 6e91f46..edff29d 100644 --- a/ssrs-custom-reports/Data File Allocation Map - Overview (SQL2012 and newer).rdl +++ b/ssrs-custom-reports/Data File Allocation Map - Overview (SQL2012 and newer).rdl @@ -1,6 +1,7 @@ Segoe UI + Eitan Blumin 0 @@ -40,27 +41,28 @@ SELECT , file_total_reserved_pages , prev_used_page , from_used_page_id = allocated_page_page_id -, to_page_id = ISNULL(NULLIF(next_used_page,file_total_size-1) - 1, next_used_page) -, consecutive_unused_pages = ISNULL(NULLIF(next_used_page,file_total_size-1) - 1, next_used_page) - allocated_page_page_id +, to_page_id = COALESCE(NULLIF(next_used_page,file_total_size-1) - 1, next_used_page, file_total_size-1) +, consecutive_unused_pages = COALESCE(NULLIF(next_used_page,file_total_size-1) - 1, next_used_page, file_total_size-1) - allocated_page_page_id , next_used_page_id = LEAD(allocated_page_page_id,1,file_total_size-1) OVER(PARTITION BY file_id ORDER BY allocated_page_page_id ASC) FROM ( SELECT - f.database_id, f.file_id, f.file_name, f.file_total_used_space, f.file_total_size + p.allocated_page_file_id , file_total_reserved_pages = COUNT(*) OVER() + 9 , p.allocated_page_page_id -, prev_used_page = LAG(p.allocated_page_page_id,1,0) OVER (PARTITION BY f.file_id ORDER BY p.allocated_page_page_id ASC) -, next_used_page = LEAD(p.allocated_page_page_id,1,f.file_total_size - 1) OVER (PARTITION BY f.file_id ORDER BY p.allocated_page_page_id ASC) -FROM ( +, prev_used_page = LAG(p.allocated_page_page_id,1,0) OVER (PARTITION BY p.allocated_page_file_id ORDER BY p.allocated_page_page_id ASC) +, next_used_page = LEAD(p.allocated_page_page_id,1, NULL) OVER (PARTITION BY p.allocated_page_file_id ORDER BY p.allocated_page_page_id ASC) +FROM sys.dm_db_database_page_allocations(DB_ID(),default,default,default,'DETAILED') AS p +) AS sub1 +INNER JOIN +( SELECT database_id, file_id, file_name = [name], size AS file_total_size , file_total_used_space = FILEPROPERTY([name], 'SpaceUsed') FROM sys.master_files AS f WHERE database_id = DB_ID() AND type = 0 ) AS f -INNER JOIN sys.dm_db_database_page_allocations(DB_ID(),default,default,default,'DETAILED') AS p -ON f.file_id = p.allocated_page_file_id -) AS sub1 -WHERE sub1.next_used_page <> sub1.allocated_page_page_id + 1 +ON f.file_id = sub1.allocated_page_file_id +WHERE ISNULL(sub1.next_used_page, f.file_total_size - 1) <> sub1.allocated_page_page_id + 1 ) AS sub2 CROSS APPLY ( @@ -396,10 +398,9 @@ CROSS APPLY =Sum(Fields!pages_in_range.Value) / 128.0 - - true + - true + true true @@ -662,7 +665,7 @@ INNER JOIN sys.database_files AS df ON df.file_id = li.FileID TranLogAllocation - 1.2cm + 1.16445cm 13.25182cm 29.35141cm true true