SQL Server 2008 Maintenance Plan Backup List

2019-08-15 17:49发布

I'm working on a Maintenance Plan for doing Backups on my server. I just want to know if SQL Server maintains a list of the backup files that were created during the backup process?

Thanks a lot!

2条回答
老娘就宠你
2楼-- · 2019-08-15 18:30
USE DatabaseName
GO

SELECT 
s.database_name,
m.physical_device_name,
CAST(CAST(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bkSize,
CAST(DATEDIFF(second, s.backup_start_date,
s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken,
s.backup_start_date,
CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn,
CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn,
CASE s.[type]
WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Transaction Log'
END AS BackupType,
s.server_name,
s.recovery_model
FROM msdb.dbo.backupset s
INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_id
WHERE s.database_name = DB_NAME() -- Remove this line for all the database
ORDER BY backup_start_date DESC, backup_finish_date
GO

By Pinal Dave SOURCE

查看更多
Fickle 薄情
3楼-- · 2019-08-15 18:38

For get this information using SQL you can run the following query

USE msdb
Go
SELECT *
FROM backupfile

complete list of backup history tables and explation of each one can be foound on MSDN http://technet.microsoft.com/en-us/library/ms188062.aspx

查看更多
登录 后发表回答