sqlrx logo
SQLRx® Tip of the Month
 
 
January 2010
Greetings!
 
Happy New Year To kick off your year smoothly, we'd like to help you ensure you have the disk space needed to perform your work.  Check out the routine below, and also make sure you monitor the 11 VitalSigns used by SQLRx to debug performance bottlenecks.
SQL 2008SQL Server Administration:  Monitor disk space free with a simple routine.  Make sure that you have room on your drives to hold the work being performed.  If you run out of disk space, your SQL Server will stop accepting requests.
 
In the code below, the @Threshold variable is designed to hold a value in MB that is the amount of space that should be available on any drive connected to your SQL Server.  Change the @Threshold value to find drives that do not have enough space free.
 
The routine below will return a list of drives that have less than 500MB free.
 

SET NOCOUNT ON

DECLARE @Threshold NUMERIC(5,0)

SET @Threshold=500  -- 500MB

CREATE TABLE #DiskSpace( 

  Drive VARCHAR(2), 

  SpaceFreeMB NUMERIC(10, 2)) 

 

INSERT INTO #DiskSpace(Drive,SpaceFreeMB) 

       EXEC('master..xp_fixeddrives')

 

SELECT Drive,SpaceFreeMB

FROM #DiskSpace

WHERE SpaceFreeMB < @Threshold

 

DROP TABLE #DiskSpace

SET NOCOUNT OFF

 
__________________________________________________________________ 
SQLRx is now a part of www.msdev.com, Microsoft's training site for solution providers!  Check the site periodically to view new training videos.
 
If you have a SQL question you'd like us to answer, and possibly use for the next SQLRx Tip of the Month or msdev video, email it to us!  If you missed any of our previous tips, you can view them here.
 
For assistance or more information on optimizing your SQL Server Environment, visit us at www.sqlrx.com or email Lori Brown at lorib@isi85.com.  

Sincerely,

Lori Brown | SQLRx Senior Consultant | Integrated Services, Inc.
4144 N. Central Expwy, Suite 430  |  Dallas, TX  75204
Phone: 214.526.7680 x 113 | lorib@isi85.com 
 
 
Integrated Services, Inc.                                    
2008 winner logo small
Turning Data Into Profit
 
Over 20 Years of Credibility & Trust
 

Join our email list          Check out our events          SQLRx Downloads