Filegroups growth rate


Job details

Name: Filegroups growth rate
Platform: Sqlserver
Category: Capacity
Description: This procedure collects space usage for the largest filegroups defined in each database. The undocumented ‘sp_MSforeachdb’ Stored Procedure is used to execute T-SQL statements against dbo.sysfiles table in every database defined on a SQL Server instance.
Long description: This procedure collects space usage for the largest filegroups defined in each database. The undocumented ‘sp_MSforeachdb’ Stored Procedure is used to execute T-SQL statements against dbo.sysfiles table in every database defined on a SQL Server instance.
Version: 2.0
Default schedule: 35 6 5 *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version > ‘2000′ & hasengine=‘YES’ & (engine_edition = ‘Microsoft SQL Server’ engine_edition = ‘Azure SQL Managed Instance’)]

Parameters

Name Default value Description
min histr interval 360 The minimum number of minutes before a new history record will be collected in the history table.
collect statistics for databases List of databases (separated by comma) for which statistics will be collected. You can use % (percent sign) to represent wild card characters. If no value specified, statistic for the largest databases will be collected (number of databases is controlled by the parameter “max databases” with the default value 5).
max filegroups 20 Number of the largest filegroups for which statistics will be collected (default value 20). To keep historical data for all filegroups set the parameter value to -1. Keep in mind that the local history table dbw_filegroups_growth_histr (in dbWatch database) can reach large sizes if there are several hundred of databases per SQL Server.
max histr interval 730 The maximum number of days before old history records will be removed from the history table (default 2 years).

Job Summary

Purpose

Why

Manual checking

SELECT DB_NAME() as DatabaseName, groupname as FileGroupName, size*8 as Size, fileproperty(name,'SpaceUsed')*8 as SpaceUsed
FROM sysfiles t1
JOIN sysfilegroups t2 ON t1.groupid = t2.groupid

Technical Details

Tables Created

Table Name Description
dbw_filegroups_growth Holds current growth data for each filegroup
dbw_filegroups_growth_histr Stores historical growth data for reporting and tracking purposes

Stored Procedure and Its Role

Job Scheduling

Report Generation

Parameters and Cleanup

Upgrade Procedures

Dependencies

This comprehensive tracking and reporting framework provided by the dbWatch task is essential for database managers overseeing large SQL Server environments, ensuring they have the tools needed to preempt storage issues effectively.