Percentage of database free space

| 1 Comment | 11,652 views
Categories:

VN:F [1.9.17_1161]
Rating: 4.1/5 (11 votes cast)

This metric measures the percentage of database free space – both reserved and unused – to help you manage space requirements more efficiently. For example, you might find this data helps you to correctly estimate file size, so you don’t suffer from problems associated with automatic file growth.

Percentage of database free space, 4.1 out of 5 based on 11 ratings

Metric definition

Metric Name:
Percentage of database free space
Description:
This metric measures the percentage of database free space - both reserved and unused - to help you manage space requirements more efficiently. For example, you might find this data helps you to correctly estimate file size, so you don't suffer from problems associated with automatic file growth.
Enter the T-SQL query that will collect data:
SELECT (AU.unallocated + AU.unused) * 100 / (AU.reserved + AU.unallocated) AS free_space_pct
  FROM (SELECT AU.reserved,
               AU.reserved - AU.used AS unused,
               CASE WHEN SF.db_size >= AU.reserved THEN (SF.db_size - AU.reserved) ELSE 0 END AS unallocated
          FROM (SELECT SUM(CAST(CASE WHEN SF.status & 64 = 0 THEN SF.size ELSE 0 END AS DECIMAL(38, 2))) AS db_size
                  FROM dbo.sysfiles AS SF) AS SF
               CROSS JOIN
               (SELECT SUM(CAST(A.total_pages AS DECIMAL(38, 2))) AS reserved,
                       SUM(CAST(A.used_pages AS DECIMAL(38, 2))) AS used
                  FROM sys.partitions AS P
                       INNER JOIN
                       sys.allocation_units AS A
                       on A.container_id = P.partition_id) AS AU) AS AU;
Select instances to collect from:
Select all
Choose databases to collect from:
All databases
Set collection frequency:
Collect data every 30 minutes
Note: If this frequency is too low or too high for your needs, choose an alternative option.
Use collected or calculated values:
Leave the Use a calculated rate of change between collections check box turned off
Metric collection is:
Enabled

Alert definition

Alert name:
Low database free space
Description:
The amount of free space for this database (including reserved and unused space) is low.
Raise an alert when the metric value goes:
Below the defined thresholds
Default threshold values:
Set the thresholds as follows:
High:10
Medium:20
Low:30
Note: These thresholds are intended as guideline values. If they seem too high or too low for your environment, replace them with values more suited to your server performance.
Raise an alert when the threshold is passed for:
Enter 3 collections
This alert is:
Enabled
VN:F [1.9.17_1161]
Rating: 4.1/5 (11 votes cast)