SQL Server Portal

I came across a question in the Forum, how to calculate the growth of all databases in a server.
So, I set out with my research for the best solution.

Given below are the two methods to calculate the growth of all databases in the server:

  • Via sp_MSforeachdb
  • Via sys.master_files

Given below is the workout that will help you understand the best way to calculate.

  • sp_MSforeachdb

Lets execute sp_MSforeachdb and view the statistics time.

autogrowthsettings1.1

After executing the above statement, I saw few server executions of sp_MSforeachdb. Given below is one of the server executions.
SQL Server Execution Times:
CPU time = 343 ms, elapsed time = 10050 ms.

  • sys.master_files

Given below is the query that  I copied from MS SQL Server profiler & modified it. (Just view growth from SSMS; you can find this query in the profiler)

autogrowthsettings1.2
After executing the above query, I saw server execution of sys.master_files and…

View original post 120 more words