我正在制定维护计划,以便在我的服务器上执行备份。 我只是想知道SQL Server是否维护了备份过程中创建的备份文件列表?
非常感谢!
答案 0 :(得分:2)
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
答案 1 :(得分:1)
要使用SQL获取此信息,您可以运行以下查询
USE msdb
Go
SELECT *
FROM backupfile
备份历史记录表的完整列表,每个记录表的解释都可以在MSDN上http://technet.microsoft.com/en-us/library/ms188062.aspx