Updated: February 22, 2012
Some time ago, I wrote and published a routine to gather disk space usage from multiple SQL Servers. Since that was written, I’ve made some bug fixes and modifications to the routine. Tracking down those changes was becoming tedious, as they were spread out over several blog posts. I’ve decided to create this page to overcome that issue. This page will always contain the latest version of the routine. The date at the top will reflect the last time I’ve made changes.
The zipfile found here contains all the code needed for this procedure. It also includes a bonus stored procedure, SQLDriveSpaceWarningEmail.sql, which I wrote about at the end of this post.
- Corrected error in script zipfile – script for ServersToCheckDiskStats table did not include IncludeInCheck column.
- Added IncludeInCheck column to ServersToCheckDiskStats table. This allows skipping of servers. Due to the foreign key constraints, you are not able to delete records from this table if there is stat data for that server in the stats table. So if a server is decommissioned or renamed or no longer needs to be tracked, set this bit to true and it will be skipped in the data collection process.
- Added SeverDisplayName column to ServersToCheckDiskStats table. If you are checking servers in different domains, this allows you to put an IP address in the ServerName field to connect with. The ServerDisplayName field will display the user-friendly name for use in reports and is the name stored in the DatabaseDiskStats table. If you are not using IP addresses, the ServerName and ServerDisplayName fields should be the same.
- Modified GatherServerDiskUsageData procedure to use above new columns.
- Added Notes column to ServersToCheckDiskStats table. Just a place to store notes.