Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have a database backup script that I run and I am wanting it to log some information about each backup. What would be the most efficient way to log the file size of each backup. A portion of the script below:
Set @StartTime = GetDate()BACKUP DATABASE @dbName TO DISK = @filename WITH INITSet @Duration = convert(varchar, (GetDate() - @StartDate), 108)Set @FileSize = ???
Scott
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2007-09-24 : 18:10:15
You can get the information from msdb.dbo.backupfile.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2007-09-24 : 18:11:34
[code]select database_name, backup_size, backup_start_date, backup_finish_date, Duration = backup_finish_date-backup_start_datefrom msdb.dbo.backupsetorder by database_name, backup_start_date desc[/code]CODO ERGO SUM