|
|
Question : Monitoring database file growth
|
|
Hi. I'd like to be able to store database file stats for all files in all databases - i.e. Maximum Size and Current Size - and to then calculate the growth of the files as a derived value over a specified period of time so that I can predict future growth. This is as much a useful exercise as anything else as I find myself taking on more and more dba tasks.
I can use sysaltfiles to a certain extent (no pun intended) but maxsize is -1 for files whose growth is not capped. I can also use DBCC showfilestats but would probably have to write a cursor-based sp to cover all databases. Is there a fairly simple and strightforwrd way of inserting the figures I need into the table I've already created so that I can then use the job I've already scheduled?
Figured this would be a straigtforward answer for someone with the know-how hence the rather stingy 50 points :)
Regards,
YaHozna.
|
Answer : Monitoring database file growth
|
|
there is an sp that helps here: sp_foreachTable that will execute commands across al tables in a database.
Try that it replaces the need for a cursor in this situation
|
|
|
|