Tuesday, February 14, 2012

Constructing a Query

Hello all,

I am fairly new to using SQL in a production environment. I've gotten the management studio pretty much figured out and now I am finding the need for some more advanced knowledge. I would like to adjust the database autogrowth settings for each of my databases; however I have no prior statistics to examine to tell me how much the past years worth of being in production has caused the databases to grow.

I have found that I can look at each database in turn and select a basic report of disk usage that happens to include records of the last few autogrowth periods and particulars about each growth. What I would like to do is create a report (The same disk usage report) that includes all of my databases (I have about 30 active databases for MS Dynamics Great Plains.) I figured that I can create a maintenance plan consisting of a transact-SQL function that will run the same query, or a similar query that will report to me: Autogrowth statistics for each database in turn since it's inception (less than a year ago).

Perhaps there is an easier way to achieve the same results. If there is a way to create / run the same disk usage report for multiple databases, and have the results returned in a consolidated form, I have not yet figured out how.

I hope that someone out there has a solution for this; what i'm sure is not a new issue but mearly a newbie issue.

Thank you all in advance for any advice you may have.

Normally, you don't want to use 'Autogrow' on production servers. Autogrow causes excessive file fragmentation, and often occurs at the most inopportune moments (Autogrow is a performance hit.)

You would be best served to determine how much new space will be required over a period of time (week, month, year, etc.) by examining the historic records you have. Then exand the database files sufficiently to allow for all activity for the next period of time.

|||Ok, I can accept that. I've got a maximum of about 8 users working on a very beefy sql box. I have no concern about overall preformance just yet. However I WILL take your advice and remove the autogrowth. I still, however need to collect some pervious growth statistics. My question still remains, is there a way to script a report that will just pull the autogrowth statistics for all of my databases from the time of their creation?|||No, as far as I am aware, that historical information is not available.|||

Ok, Then lets take one step further back.

Since there is already a builtin 'disk usage' report that can be run on a database. Can I use a Transact Sql query to pull that same report (which will contain autogrowth history) for all (or a select number) of databases and filter through it at my leasure?

If so, I'll probably need some help with scripting of said query.

Thank you for your time and advice,

No comments:

Post a Comment