Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Track database growth


Track database growth

Author
Message
Edward Sun
Edward Sun
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 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
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 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
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: 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
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1833 Visits: 1210
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
Say Hey Kid
Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)Say Hey Kid (691 reputation)

Group: General Forum Members
Points: 691 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 Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 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-Enthusiastic
SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)

Group: General Forum Members
Points: 166 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
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: 2331 Visits: 3180
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
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: 8692 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