|
Hi Team I am New In SQL Server and i have given a task to create a job which calculate the growth rate of SQL Database . Is there any query through which i can calculate the growth rate of my SQL Database Thanks Basit Khan
(comments are locked)
|
|
You'll need a table to store the sizes and record the time you recorded the size. Then schedule a query to record the sizes. How often you run it depends on the level of granularity you want to use for your trend - hourly, daily, weekly etc. I like to track data file size separately from log size, and the scripts below reflect a very simple version of that. You can get quite sophisticated if you need. Create the tables (you won't want yours in tempdb, I just put together a sample you can run from end-to-end that cleans up after itself): Run a query periodically to populate them: Query the table with excel for pretty trend graphs. Or, just run something in SSMS: As well as the size of the database files, it's also worth keeping track of the amount of free space or space used within the database...
May 30 '12 at 08:21 AM
ThomasRushton ♦
@ThomasRushton Very nice suggestion.
May 30 '12 at 09:36 AM
Usman Butt
(comments are locked)
|
|
Thanks Every one....i have tried to make this query from two table in MSDB Database 1 Backupset and other is backupfile Provide the Database name That seems like a reasonable approach to looking at historical changes to database backup file sizes. Going forward, I would still suggest that it makes sense to do trending that is a little more intentional.
May 30 '12 at 08:25 PM
KenJ
tried to run the query but getting the error message below: Msg 137, Level 15, State 2, Line 3 Must declare the scalar variable "@dbname". Msg 137, Level 15, State 2, Line 19 Must declare the scalar variable "@dbname" Not sure how to solve this. Thx. Gary
Nov 15 '12 at 02:32 PM
tounkara
Just replace
Nov 15 '12 at 06:31 PM
ThomasRushton ♦
(comments are locked)
|
|
Is there a way to pass the dbnames using a variable instead of typing each one at a time?
(comments are locked)
|

