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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Backup file size

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2007-09-24 : 17:56:41
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 INIT
Set @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 Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

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_date
from
msdb.dbo.backupset
order by
database_name,
backup_start_date desc

[/code]

CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-25 : 02:28:09
MVJ: There's a slightly fuller query for What Was Backed Up here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=54300#273265

if you are interested, and a What Was Restore a bit higher up that thread.

Kristen
Go to Top of Page
   

- Advertisement -