SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Total Space Used for all databases per disk


Total Space Used for all databases per disk

Author
Message
gonzamole
gonzamole
SSC Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 Visits: 464
Comments posted to this topic are about the item Total Space Used for all databases per disk
brandon.lukes
brandon.lukes
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 161
This doesn't take into account the use of mount points. Is there an easy substitution for xp_fixeddrives? Thanks.
simon.murin
simon.murin
SSC-Enthusiastic
SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)SSC-Enthusiastic (167 reputation)

Group: General Forum Members
Points: 167 Visits: 575
The script fails if you have any mirrored databases
Jason Crider
Jason Crider
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2319 Visits: 2232
Here's one way to deal with Mount points.

http://www.sqlservercentral.com/blogs/adventuresinsql/2010/11/15/get-drive-space-including-mount-points/

MCITP, Database Administrator
A hodgepodge of Information Technology and Life
LinkedIn Profile
My Twitter
brandon.lukes
brandon.lukes
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 161
We do have a process to get disk/mount space via a powershell script. So we have that covered. I was just hoping that there was an easy replacement for xp_fixeddrives for this script.
Jason Crider
Jason Crider
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2319 Visits: 2232
You could use a CLR as well.

A few more:
http://connect.microsoft.com/SQLServer/feedback/details/642004/denali-xp-fixeddrives-does-not-display-mounted-volume-information-on-a-cluster

http://weblogs.sqlteam.com/tarad/archive/2007/12/18/60435.aspx

may look through the comments here:
http://sqlblog.com/blogs/andy_leonard/archive/2010/05/27/t-sql-snack-how-much-free-storage-space-is-available.aspx

MCITP, Database Administrator
A hodgepodge of Information Technology and Life
LinkedIn Profile
My Twitter
aleksey donskoy
aleksey donskoy
SSC-Enthusiastic
SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)

Group: General Forum Members
Points: 157 Visits: 519
Awesome script. Very useful. One little bug in the #logsizestats table definition:

[DBName] varchar(65),

should be

[DBName] varchar(255),

causes string truncation on the sharepoint databases (or any other long name databases)

Thanks
Alex Donskoy
SQL Server DBA from Miami, FL
SQLVoila
SQLVoila
SSC Veteran
SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)SSC Veteran (288 reputation)

Group: General Forum Members
Points: 288 Visits: 185
brandon.lukes (5/23/2012)
We do have a process to get disk/mount space via a powershell script. So we have that covered. I was just hoping that there was an easy replacement for xp_fixeddrives for this script.


for SQL 2008R2 or above, sys.dm_os_volumne_stats (database_id, file_id) can be the substitute for xp_fixeddrives. you will need to rewrite somewhat the OP's script though.
Nadrek
Nadrek
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7124 Visits: 2741
aleksey donskoy (1/8/2014)

[DBName] varchar(65),

should be

[DBName] varchar(255),


In at least sys.databases, database name is of SYSNAME type, which currently equates to nvarchar(128) NOT NULL. While I can understand using a VARCHAR(128) if one is certain the character set strictly fits within a VARHCAR, I'm a little puzzled as to where the choice of 255 bytes comes from.
aleksey donskoy
aleksey donskoy
SSC-Enthusiastic
SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)SSC-Enthusiastic (157 reputation)

Group: General Forum Members
Points: 157 Visits: 519
Nadrek (1/9/2014)
aleksey donskoy (1/8/2014)

[DBName] varchar(65),

should be

[DBName] varchar(255),


In at least sys.databases, database name is of SYSNAME type, which currently equates to nvarchar(128) NOT NULL. While I can understand using a VARCHAR(128) if one is certain the character set strictly fits within a VARHCAR, I'm a little puzzled as to where the choice of 255 bytes comes from.


What's the point of your post? To paste one more Books Online paragraph?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search