Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to get average log backup size?

Status
Not open for further replies.

cwbrumett

Programmer
Dec 9, 2005
12
US
I need to capture some database growth stats for a hardware purchase. I'm currently doing backup with weekly fulls, daily diffs, and t logs every 15 mins.

I was thinking I could get an average of my t log backups to figure out future growth.

thanks for any help.
 
found it ... for anyone else that reads this.

Code:
SELECT 
   CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
   msdb.dbo.backupset.database_name, 
   msdb.dbo.backupset.backup_start_date, 
   msdb.dbo.backupset.backup_finish_date,
   CASE msdb..backupset.type 
       WHEN 'D' THEN 'Database' 
       WHEN 'L' THEN 'Log' 
   END AS backup_type, 
   msdb.dbo.backupset.backup_size, 
    convert (decimal(30,2), (msdb.dbo.backupset.backup_size + 1536) / 1024) As SizeInKB,
    convert (decimal(30,2), (msdb.dbo.backupset.backup_size + 1536) / 1024 / 1024) As SizeInMBs,
    convert (decimal(7,3), (msdb.dbo.backupset.backup_size + 1536) /1024 / 1024 / 1024) As SizeInGBs

FROM   msdb.dbo.backupmediafamily 
   INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 

WHERE  
	--pull only last 90 days
	(CONVERT(datetime, msdb.dbo.backupset.backup_start_date, 102) >= GETDATE() - 90) 
	--only want logs
	AND msdb..backupset.type = 'L'

ORDER BY 
   msdb.dbo.backupset.database_name,
   msdb.dbo.backupset.backup_finish_date
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top