Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Monitor Database size

Author  Topic 

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2012-08-16 : 09:55:49
Hello,

I wrote a CTE to get the database file size and available space using sys.database_files table.

Can anyone tell me how to write a query to calculate % increase weekly for each database?

Thanks,

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-08-16 : 10:04:35
Log it to a table then just compare the last reading with that for the previous week.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2012-08-16 : 14:01:22
I will have to exclude the first row though as there won't be any previuos record to compare against.

Do you have a sample of it?
Go to Top of Page

tfountain
Constraint Violating Yak Guru

491 Posts

Posted - 2012-08-20 : 14:03:19
If you do backups on a regular schedule, just query the tables in msdb to calculate the deltas. This will provide you information on their growth rate. This way you're not reinventing the wheel (logging to a table) and you just measure the difference between your full backups. If you have differentials in mix that provides the rate of change to the granularity of whatever schedule your diffs are on.
Go to Top of Page
   

- Advertisement -