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


Track database growth


Track database growth

Author
Message
Edward Sun
Edward Sun
Valued Member
Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)

Group: General Forum Members
Points: 52 Visits: 226
Irwan,

I like your script. But one thing I need to point out is that 'master..xp_fixeddrives' doesn't work with the mounted volumes supported by sql2005 and above.

Ed
Irwan Tjanterik
Irwan Tjanterik
SSC-Enthusiastic
SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)SSC-Enthusiastic (142 reputation)

Group: General Forum Members
Points: 142 Visits: 310
Hi Ed

Thanks for letting me know, I guess when I wrote the script it is purely to ensure that I know when my databases are running out of space, as for mounted volumes, I won't normally put my databases in there.

Regards

Irwan
lepoto.masedi
lepoto.masedi
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 63
Thanks, it works fine
pkrudysz
pkrudysz
SSC-Enthusiastic
SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)

Group: General Forum Members
Points: 158 Visits: 267
Mike Tutor (2/22/2010)
Thanks for the great script. I created a table with a capture date and put your script (with some minor modifications) into a weekly job. This way I can keep a history of database growth and use it for charting expected growth etc.

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBStats]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DBStats]
GO

CREATE TABLE [dbo].[DBStats] (
...
GO


And that's what makes this useful. We need to know how much a file has grown over a period of time, and predict how much it will grow in the future.
henrik staun poulsen
henrik staun poulsen
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2643 Visits: 1226
Hi Irwan,

I had to do a :
FileCurrentSize = (cast(SF.size as bigint) * 8)/1024,

in order to avoid an integer overflow.

Best regards,
Henrik Staun Poulsen
www.stovi.com



Paulo A. Nascimento
Paulo A. Nascimento
SSC Eights!
SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)

Group: General Forum Members
Points: 912 Visits: 207
And just for the record, it also works in SQL Server 2012 (why shouldn't it...). Had to get rid of some funky chars (most probably due to some enconding issue), solve the brackets issue too, and now works smoothly.

Thanks,
rjoseph
rjoseph
SSC-Enthusiastic
SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)

Group: General Forum Members
Points: 153 Visits: 145
Hi Everyone,

I am trying to execute this script as it is on a SQL 2000 and 2008. I am getting all sort errors. Please see below. Can anyone help please

Msg 170, Level 15, State 1, Line 8
Line 8: Incorrect syntax near ' '.
Msg 137, Level 15, State 1, Line 11
Must declare the variable '@sql'.
Msg 170, Level 15, State 1, Line 12
Line 12: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 22
Line 22: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 30
Line 30: Incorrect syntax near ' '.
Msg 137, Level 15, State 1, Line 37
Must declare the variable '@sql'.
Msg 137, Level 15, State 2, Line 38
Must declare the variable '@sql'.
Msg 170, Level 15, State 1, Line 41
Line 41: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 53
Line 53: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 60
Line 60: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 65
Line 65: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 79
Line 79: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 111
Line 111: Incorrect syntax near ' '.
Msg 137, Level 15, State 2, Line 112
Must declare the variable '@sql'.
Msg 170, Level 15, State 1, Line 116
Line 116: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 118
Line 118: Incorrect syntax near ' '.
Msg 137, Level 15, State 2, Line 124
Must declare the variable '@sql'.
Msg 156, Level 15, State 1, Line 132
Incorrect syntax near the keyword 'END'.
Msg 170, Level 15, State 1, Line 136
Line 136: Incorrect syntax near ' '.
Msg 170, Level 15, State 1, Line 143
Line 143: Incorrect syntax near 'DSP'.
Msg 170, Level 15, State 1, Line 144
Line 144: Incorrect syntax near 'DSP'.
Msg 170, Level 15, State 1, Line 145
Line 145: Incorrect syntax near 'DSP'.
Chris93147
Chris93147
SSC Veteran
SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)

Group: General Forum Members
Points: 244 Visits: 389
Try running the script that was posted on 2/22/2010 10:47:26 PM

Chris
SQL-DBA-01
SQL-DBA-01
SSCrazy Eights
SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)

Group: General Forum Members
Points: 8666 Visits: 3592
Hello Mike Tutor,

Can you please paste your script here to know what kind of chyanges did you do to get daily alert/reports?

Thanks.

Thanks.
Iwas Bornready
Iwas Bornready
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22868 Visits: 885
Thanks for the script.
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