July, the 31 Days of SQL Server DMO’s – Day 27 (sys.dm_db_file_space_usage)
Posted
by Tamarick Hill
on SQL Blog
See other posts from SQL Blog
or by Tamarick Hill
Published on Sat, 27 Jul 2013 13:31:52 GMT
Indexed on
2013/08/02
15:53 UTC
Read the original article
Hit count: 521
The sys.dm_db_file_space usage DMV returns information about database file space usage. This DMV was enhanced for the 2012 version to include 3 additional columns. Let’s query this DMV against our AdventureWorks2012 database and view the results.
SELECT * FROM sys.dm_db_file_space_usage
The column returned from this DMV are really self-explanatory, but I will give you a description, paraphrased from books online, below.
The first three columns returned from this DMV represent the Database, File, and Filegroup for the current database context that executed the DMV query. The next column is the total_page_count which represents the total number of pages in the file. The allocated_extent_page_count represents the total number of pages in all extents that have been allocated. The unallocated_extent_page_count represents the number of pages in the unallocated extents within the file. The version_store_reserved_page_count column represents the number of pages that are allocated to the version store. The user_object_reserved_page_count represents the number of pages allocated for user objects. The internal_object_reserved_page_count represents the number of pages allocated for internal objects. Lastly is the mixed_extent_page_count which represents the total number of pages that are part of mixed extents.
This is a great DMV for retrieving usage space information from your database files.
For more information about this DMV, please see the below Books Online link:
http://msdn.microsoft.com/en-us/library/ms174412.aspx
Follow me on Twitter @PrimeTimeDBA
© SQL Blog or respective owner