November 25, 2016 at 6:38 am
I need query to get the database growth to analyse in the format date , Size of the backup file GB , growth GB and Max size of datafile .
November 25, 2016 at 7:20 am
Use the queries below to get the desired information.
Execute it at regular intervals (daily?) and store the results. Build a reporting query on these stored results to get the differences in size over time.
SELECT Db_name(database_id) AS database_name
, NAME AS file_name
, type_desc
, Cast(size * 8.0 / 1024 AS DECIMAL(10, 2)) AS size_MB
, Cast(max_size * 8.0 / 1024 AS DECIMAL(10, 2)) AS max_size_MB
, GetDate() as inquiry_date
FROM sys.master_files;
SELECT database_name
, backup_size
, compressed_backup_size
, GetDate() as inquiry_date
FROM msdb..backupset;
December 1, 2016 at 9:49 pm
This was removed by the editor as SPAM
December 2, 2016 at 5:51 am
JasonClark (12/1/2016)
you may use this command SP_TRACK_GROWTH
Where did you get this? I am not aware that this even exists.....
December 2, 2016 at 2:25 pm
kevaburg (12/2/2016)
JasonClark (12/1/2016)
you may use this command SP_TRACK_GROWTHWhere did you get this? I am not aware that this even exists.....
It doesn't, not as a built in function anyway. There was one stored procedure used by many over ten years ago - the only reason I remember it. Then some modifications by others, etc.
I doubt any version use the current DMVs. Here is the original if you are interested - date is 2001. But the guy did have some very good scripts on his site back in the day:
http://vyaskn.tripod.com/code/sp_track_db_growth.txt
Sue
December 3, 2016 at 9:13 am
HanShi (11/25/2016)
Use the queries below to get the desired information.Execute it at regular intervals (daily?) and store the results. Build a reporting query on these stored results to get the differences in size over time.
SELECT Db_name(database_id) AS database_name
, NAME AS file_name
, type_desc
, Cast(size * 8.0 / 1024 AS DECIMAL(10, 2)) AS size_MB
, Cast(max_size * 8.0 / 1024 AS DECIMAL(10, 2)) AS max_size_MB
, GetDate() as inquiry_date
FROM sys.master_files;
SELECT database_name
, backup_size
, compressed_backup_size
, GetDate() as inquiry_date
FROM msdb..backupset;
Just a bit of a simplification...
SELECT Db_name(database_id) AS database_name
, NAME AS file_name
, type_desc
, Cast(size / 128.0 AS DECIMAL(10, 2)) AS size_MB
, Cast(max_size / 128.0 AS DECIMAL(10, 2)) AS max_size_MB
, GetDate() as inquiry_date
FROM sys.master_files;
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply