1

我正在制定一项维护计划,以便在我的服务器上进行备份。我只想知道 SQL Server 是否维护在备份过程中创建的备份文件列表?

非常感谢!

4

2 回答 2

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

皮纳尔戴夫 SOURCE

于 2014-01-22T19:51:17.787 回答
1

要使用 SQL 获取此信息,您可以运行以下查询

USE msdb
Go
SELECT *
FROM backupfile

备份历史表的完整列表和每一个的解释可以在 MSDN http://technet.microsoft.com/en-us/library/ms188062.aspx上找到

于 2014-01-22T19:40:33.153 回答